Choice: Pick One Option With Jev
Last checked · Independent guide, not affiliated with TypeSafe AI
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.
The shape of a Choice
Section titled “The shape of a Choice”"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:
"queue": { "type": "choice", "choice": "technical", "confidence": 0.94, "probabilities": { "billing": 0.04, "technical": 0.96, "sales": 0, "other": 0 }}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.
What the fields mean
Section titled “What the fields mean”| 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.
Writing good options
Section titled “Writing good options”- Include an escape hatch. Add
otherornone of the abovewhenever 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.
Choice versus the other types
Section titled “Choice versus the other types”| 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.
More than 255 options
Section titled “More than 255 options”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.
Using the answer
Section titled “Using the answer”answer = response.answers["queue"]if answer.confidence < 0.6: route_to_human(ticket) # the model is unsure between optionselse: 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.