Decisions
Updated
A decision pairs your state with named questions and returns each result under its name.
Choose boolean, choice or score to match the answer you need.
State
State accepts a JSON object, array or string. Nested numbers, booleans and null remain JSON. Supply your own units, coordinate frames and freshness data.
Use compact keys. Send large integers and exact decimals as numeric strings when precision matters. Keep application data in state and the task in each question's instructions.
Plain HTTP decide has no state_version or sequence field. Keep your own sequence or timestamp inside state and associate each response with the request you sent.
Standard text state supports up to 38,000 tokens. The complete JSON request, including questions and attachments, must fit 3,665,920 bytes. The 64k and 128k bands are served through Danger zone with SZ-Danger-Zone: long_context_64k or long_context_128k. Read Danger zone for access steps and limits. A token limit does not guarantee the serialized body will fit. Questions and request formatting also count toward the rendered input limit.
For changing state, use Streaming. Each accepted mutation advances state_version. Check the version on each decision before using its answer; newer state may already have arrived.
Question types
| Type | Use it for | Result |
|---|---|---|
boolean | A yes-or-no decision. | A boolean decision and the probability of true. |
choice | Selecting a named option. | The selected option and a probability for each option. |
score | Assigning an ordered rating. | An expected level, its legend and probabilities for the levels. |
Each question has a name, a type and instructions. Instructions must be a nonblank string or a nonempty JSON object or array.
Use a criteria object for choice and an ordered criteria array for score. Keep their counts within limits.choice_options and limits.score_levels from the model list; other counts return 422 invalid_criteria.
Results
Read each result under its question name in answers.
Read answers.damaged in your response. For a boolean, probability is the likelihood of true. decision is true when true is at least as likely as false; confidence is the selected outcome's probability.
For a choice, decision equals choice and confidence is probabilities[choice], the maximum option probability. A tied maximum preserves choice.
For a score, decision is the most likely level key string; ties choose the lowest level. confidence is that level's probability; score remains the expected level index.
alternatives lists every other outcome as { decision, confidence } objects. Entries use descending confidence; tied choices use UTF-8 key byte order and tied score levels use level order.
calibration_version: An opaque public identifier, or unpublished when none is assigned. A nonempty identifier does not prove calibration.
calibrated is false in this release; a calibration_version value does not make it true.
Legacy idempotent replays retain their stored answer shape. Do not use legacy confidence as decision probability.
With a request policy, an answer below your threshold has abstained: true and no decision.
Question refusals
A flagged question can return an error while the other questions are answered. Check each entry in answers, even when the HTTP status is 200.
If every question is flagged, the whole request is refused.