Select best
Select best compares several candidate responses and picks the one that best satisfies your criteria, returning a probability per candidate. `output` is candidate 0 and `outputs` holds the alternatives. It mirrors promptfoo's `select-best`.
What the evaluator does
One Jev Choice question over the candidates. The label is the winning index; the details list every candidate with its probability; pass means `output` (candidate 0) won.
Which candidate best satisfies `criteria`?
The question, verbatim
This is the question the API sends for the example below, generated from the same code path the playground and API use. Jev sees the request fields as state and returns a probability for each outcome. Nothing is generated, so there is nothing to parse.
`output` is candidate 0 and `outputs` are candidates 1…n, all responses to `input`. Which candidate best satisfies `criteria`?
- 0Candidate 0: Refunds are issued within 5-7 business days after we receive the returned item.
- 1Candidate 1: Refunds take about a week.
- 2Candidate 2: We refund you once the return arrives, typically 5-7 business days.
Reach for it when
- Ranking prompt or model variants on the same input.
- Choosing among n sampled responses before showing one to a user.
- Preference data collection without a human in the loop.
Not the right tool when
- Absolute quality of one response (use g_eval or llm_judge).
- Exactly two candidates with a baseline (battle is simpler).
Watch out for
- Shuffle candidate order across a dataset to average out any position preference.
- Very long candidates are truncated in the option descriptions; the full texts remain in the state.
What to send
score mapped from the chosen option, label = option key, confidence, a probability per option, passed by option.
{
"evaluators": [
"select_best"
],
"input": "How long do refunds take?",
"output": "Refunds are issued within 5-7 business days after we receive the returned item.",
"outputs": [
"Refunds take about a week.",
"We refund you once the return arrives, typically 5-7 business days."
],
"criteria": "Precise timing and the condition that the item must be received."
}Candidate 0 wins with a clear margin.
Aggregate with
One result per item is a fact; a dataset of them is a metric. These are the aggregations that fit this evaluator's output shape.
- What does select_best return?
- The index of the best candidate as the label, the probability of that choice as the score, a probability for every candidate, and a details row per candidate.