Skip to content
JevDirectory.org
OfficialPractices & PatternsVerified 2026-09-20

Choice

Pick one option from a set you define. Returns the option, the full probability distribution, and 0-1 confidence, with up to 255 options and parallel questions that barely add latency.

Category
Practices & Patterns
Published by
TypeSafe AI
Author
Added
2026-09-20
Tagsofficialprimitiveschoiceconfidenceclassification

Highlights

  • Option names and descriptions are both sent to the model; use null when a name speaks for itself.
  • An ambiguous ticket example reads returns 0.61 vs billing 0.35 with confidence 0.42.
  • Ask several Choice questions per call: they run in parallel and response time barely changes.
  • Chain choices level by level for deep hierarchies, as in the hierarchical classification cookbook.

Quickstart

python
Choice(
    instructions="Which team should handle this?",
    criteria={
        "returns": "Exchanges, wrong or damaged items",
        "shipping": "Delivery status, delays, lost packages",
        "billing": "Charges, invoices, payment problems",
    },
)

Watch out

Speculative questions still cost tokens even when your code ignores their answers, so weigh extra options against the input bill.

More like this

The yes/no primitive: one probability from 0 to 1, where the value is the answer and no separate confidence is needed. True and false criteria pin down subtle boundaries.
Practices & Patterns#official#primitives#noul
Official
Rate content against 2 to 10 ordered levels. Returns a probability-weighted score that can land between levels, per-level probabilities, and confidence, with the arithmetic left to code.
Practices & Patterns#official#primitives#score
Official
Use the answer to decide what to do and confidence to decide whether to act: the voice-banking example routes below 0.6 to a human and needs 0.85 or more to auto-approve a transfer.
Practices & Patterns#official#patterns#confidence
Official
Back to all resources

From the community

Posts from builders shipping with Jev right now.

700 leads scored for $0.09

Beating Gemini Flash Lite on an eval