Skip to content

Choice: Pick One Option With Jev

Last checked · Independent guide, not affiliated with TypeSafe AI

ANSWER

A Choice asks Jev to pick one option from a set you define, up to 255 options. The answer includes the winning option in choice, a probability for every option in probabilities, and a confidence value between 0 and 1. Use it when the answer is one of several categories with no order between them.

Request
"queue": {
"type": "choice",
"instructions": "Which team should handle this message?",
"criteria": {
"billing": "Charges, invoices, refunds, seats on the bill",
"technical": "Bugs, outages, login problems, integrations",
"sales": "New plans, upgrades, quotes",
"other": "Anything else"
}
}

criteria maps each option name to a description. The description tells the model where the boundary of that option lies; use null when the name alone is clear. The option names are what your code receives back.

For the message “My invoice lists two seats, but only one of us can sign in, and the login page keeps timing out.”, Jev 1.13 returned:

Answer
"queue": {
"type": "choice",
"choice": "technical",
"confidence": 0.94,
"probabilities": { "billing": 0.04, "technical": 0.96, "sales": 0, "other": 0 }
}
technical0.96
billing0.04
sales0.00
other0.00
The message mentions both a billing detail (two seats) and a login failure; Jev put most of the weight on the login problem.

A clearer message, “Please send me a quote for 40 more seats on the annual plan.”, came back as sales with 0.99 probability and 0.99 confidence.

Field Meaning
choice The option with the highest probability
probabilities A probability for every option you defined; they sum to 1
confidence A 0 to 1 summary of how concentrated the distribution is. A flat spread means low confidence

The answer is always one of your option names. There is no way for Jev to return a category you did not offer, which is why you should offer a way out.

  • Include an escape hatch. Add other or none of the above whenever the list might not cover every input. Without it, Jev has to pick something.
  • Give the full list. TypeSafe notes that each extra option costs only a few tokens, so list every team, category or product rather than a shortlist.
  • Describe boundaries, not just names. “Charges, invoices, refunds, seats on the bill” separates billing from sales better than “billing”. Descriptions can also be JSON objects with inclusions, exclusions and examples.
  • Keep options at one level. For deep taxonomies, ask one Choice per level and walk the tree in code, using each node’s children as the next options.
If the answer is Use
One of several unordered categories Choice
A position on an ordered scale (low to high) Score
A yes or no, where the probability itself matters Noul

A Choice with only yes and no options is not the same as a Noul: TypeSafe’s own example shows the two giving quite different numbers for the same question. The Choice compares options against each other; the Noul judges one statement on its own.

A Choice accepts at most 255 options. With more candidates, narrow them first: score candidates independently with Nouls or a cheap filter in code, then ask a Choice among the best ones. TypeSafe’s Wikipedia-racing demo, which chose among hundreds of links per page, used this two-stage approach.

answer = response.answers["queue"]
if answer.confidence < 0.6:
route_to_human(ticket) # the model is unsure between options
else:
assign(ticket, team=answer.choice)

If all you need is the best option, take choice and skip thresholds. Use confidence, or the full probabilities, when a wrong pick is costly. See Confidence.

Sources

  1. Choice (TypeSafe docs)
  2. Primitives: choose a question type (TypeSafe docs)
  3. Advanced: structured Choice options (TypeSafe docs)
  4. Confidence (TypeSafe docs)