Skip to content

Decision Answers

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 type Meaning System One OpenAI Decisions
DecisionResponse.id: Option<String> Provider response identifier, when available. Optional id The current adapter reads no response ID and returns none
DecisionResponse.model: Option<ModelId> Provider-reported model identifier. Optional model model
DecisionResponse.answers: BTreeMap<String, DecisionAnswer> Answers matched by question ID. answers object answers[], identified by name
DecisionAnswer.value: DecisionValue Typed estimate matching the question's kind. noul, choice, or score probability, choice, or score
DecisionAnswer.provider_confidence: Option<ProviderConfidence> Provider-specific confidence with its own scale and meaning. Optional confidence Optional confidence
DecisionResponse.usage: Usage Available token counts; absent counts remain unknown. Deserialized into Usage Counts normalized into Usage, separating cache reads and writes from aggregate input

Answer values

Variant and fields Contract System One OpenAI Decisions
BooleanEstimate::Value(bool) A Boolean-only judgment with no implied certainty. The supplied adapter returns a probability instead The 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 noul type: "predicate", field probability
DecisionValue::Choice with selected: String and probabilities: Option<BTreeMap<String, Probability>> Select a declared ID. When supplied, the distribution covers every declared option. choice; optional ID-keyed probabilities choice; probabilities[] with option value and probability, converted to a map
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 level score; 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.

The OpenAI adapter treats a refusal as an error because DecisionValue has no refusal variant. Transport failures and upstream HTTP errors also 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.