Skip to navigation

Decision Answers

View as Markdown

For the integration flow, read Decision Model-Related Protocols. For question IDs, options, and rubric definitions, use Decision Questions.

Response fields

DecisionResponse.answers maps the request’s question IDs to DecisionAnswer values. Each answer separates its value from optional provider confidence.

Protocol field and typeMeaningSystem OneOpenAI Decisions
DecisionResponse.id: Option<String>Provider response identifier, when available.Optional idThe current adapter reads no response ID and returns none
DecisionResponse.model: Option<ModelId>Provider-reported model identifier.Optional modelmodel
DecisionResponse.answers: BTreeMap<String, DecisionAnswer>Answers matched by question ID.answers objectanswers[], identified by name
DecisionAnswer.value: DecisionValueTyped estimate or refusal.noul, choice, score, or refusalpredicate, choice, score, or refusal
DecisionAnswer.provider_confidence: Option<ProviderConfidence>Provider-specific confidence with its own scale and meaning.Optional confidenceOptional confidence
DecisionResponse.usage: UsageAvailable token counts; absent counts remain unknown.Deserialized into UsageCounts normalized into Usage, separating cache reads and writes from aggregate input

Answer values

Variant and fieldsContractSystem OneOpenAI Decisions
DecisionValue::RefusalThe provider declined this question. Sibling answers remain available.type: "refusal"type: "refusal"
BooleanEstimate::Value(bool)A Boolean-only judgment with no implied certainty.The supplied adapter returns a probability insteadThe supplied adapter returns a probability instead
BooleanEstimate::ProbabilityTrue(Probability)Probability of true on a [0, 1] scale. The algorithm chooses any threshold.type: "noul", field noultype: "predicate", field probability
DecisionValue::Choice with selected: String and probabilities: Option<BTreeMap<String, Probability>>Select a declared ID.choice; optional probabilities keyed by option ID; some IDs may be absentchoice; probabilities[] with a value and probability for every option
DecisionValue::Score with value: ScoreValue and probabilities: Option<Vec<Probability>>Position in 0..=N-1; the optional distribution follows the question’s level order.score; optional probabilities keyed by numeric strings, reordered by levelscore; numeric value / probability entries, reordered by level

DecisionValue::Boolean wraps a BooleanEstimate. An absent distribution stays unknown; it does not become a one-hot distribution. Likewise, a Boolean-only answer does not imply probability zero or one.

Probability, ScoreValue, and ProviderConfidence are public numeric wrappers. Their stated ranges and meanings are contracts, not validation performed by their constructors. Keep answer probability separate from provider confidence.

Matching and errors

Retain the request when converting a response. Question IDs identify the expected kind; choice IDs identify valid selections; rubric order gives scores meaning. Both clients match responses against the request and perform format-specific checks. An unexpected ID, kind, or malformed supported response can produce LlmClientError::ResponseTranslation.

If the route question was refused or its apply_cutoff_to probability is missing, the cutoff classifier uses its fallback when fail_open is enabled. Otherwise it returns an error identifying the refusal or the missing probability.

Transport failures and upstream HTTP errors surface through LlmClientError. A host converts its work result to libsy::Result<DecisionResponse> when replying through CallDecision::respond.

These clients do not retry automatically. Their constructors accept a timeout covering the HTTP request and reading the body. See the question reference’s adapter links for the exact conversion and error paths.

Conversion guarantees

Supported decision fields map directly while retaining question IDs, answer probabilities, rubric positions, and confidence. OpenAI text-only fields carry structured protocol values as JSON text. This preserves content, rather than making the wire formats identical or guaranteeing arbitrary JSON round trips.

The provider must actually report a field for it to be available. Keep missing IDs, confidence, distributions, and usage unknown. For cache and reasoning token semantics, see LLM usage.

Return to the decision protocol guide to connect the response to your application’s execution loop.