Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 6.21 KB

decision_questions.md

File metadata and controls

64 lines (50 loc) · 6.21 KB

Decision Questions

For the integration flow and a request example, read Decision Model-Related Protocols. For result interpretation and provider response mappings, continue to Decision Answers.

System One is a common API for open decision models, including Jev. SystemOneClient uses /v1/systemone; OpenAiDecisionClient uses /v1/decisions. Both accept DecisionRequest.

Request fields

Protocol field and type Meaning System One OpenAI Decisions
DecisionRequest.model: Option<ModelId> Selected decision model. The HTTP adapters require it before sending. model model
DecisionRequest.context: Value Shared conversation, application state, or other material to evaluate. JSON-valued state Text-valued input; structured values are serialized as JSON text
DecisionRequest.questions: BTreeMap<String, DecisionQuestion> Independent questions keyed by stable IDs. questions object, keyed by ID questions[], with each ID in name
DecisionQuestion.instructions: Value Instructions for one question. JSON-valued instructions Text-valued instructions; structured values become JSON text
DecisionQuestion.kind: DecisionKind Expected Boolean, choice, or rubric-score answer. Question type and criteria Question type, with choices or levels where applicable

Question IDs identify the answers. Preserve them through conversion; an array position alone is not a replacement for an ID. Context is shared across the request, while each question has its own instructions.

Question kinds

Kind and fields Contract System One OpenAI Decisions
DecisionKind::Boolean with true_description: Option<Value> and false_description: Option<Value> Ask for a Boolean judgment or probability of true. Descriptions define the two answers when needed. type: "noul"; descriptions in criteria.true and criteria.false type: "predicate"; descriptions are included in instruction text because there are no separate fields
DecisionKind::Choice with options: Vec<ChoiceOption> Declare a nonempty list of options with unique IDs, preserving their order in the protocol. type: "choice"; criteria maps option IDs to descriptions type: "choice"; choices[] carries value and optional description
DecisionKind::Score with levels: Vec<Value> Declare at least two levels, ordered low to high and indexed from zero. type: "score"; criteria is the level array type: "score"; levels[].label carries each level's text
ChoiceOption.id: String Stable ID used by the selected answer and any distribution. Key in criteria choices[].value
ChoiceOption.description: Option<Value> Optional meaning when the ID alone is insufficient. JSON-valued description; absent description becomes null Text description when supplied; structured values become JSON text

Choice questions can contain more than two options. A score is a position on the declared rubric, including fractional positions; it is not an arbitrary numeric measurement. Keep the question's levels when interpreting the answer.

Construction and validation

The fields are public. Constructing or deserializing a DecisionRequest does not enforce all question contracts. Supply a selected model for HTTP calls, valid option IDs, and a correctly ordered rubric. The adapters apply their format-specific checks; they are not a general validation layer for every possible backend.

Enums in the protocol's own serialized form use snake-case type tags with a data payload. Provider payloads use the mappings above. Serializing the protocol value directly is therefore not a substitute for a provider adapter.

Provider adapters

The System One implementation and OpenAI Decisions implementation are reference examples of request encoding and response conversion. Both supplied clients make one attempt per call, with a timeout covering the request and reading the body.

You can use either supplied client, or convert an existing client's data yourself. RoutedDecisionClient is an optional shared client interface. The guide's direct call handling shows the application boundary; Decision Answers covers the response contract.