Skip to content
docs

Decisions (System One)

POST /v1/systemone answers typed questions about data. You send a state (state) and a set of questions, and in one call the model answers each of them with probabilities. The request and the response follow TypeSafe’s System One API, so the TypeSafe SDK connects by changing the address and the key.

The endpoint serves only models of the decision class; currently that is TypeSafe Jev. GET /v1/models?output_modalities=decisions returns their list; see Models.

Terminal window
curl https://api.waibee.com/v1/systemone \
-H "Authorization: Bearer $WAIBEE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jev-latest",
"state": "Customer writes: I want my money back for order 1042",
"questions": {
"route": {
"type": "choice",
"instructions": "Which team handles this ticket?",
"criteria": {"sales": "buying", "refunds": "money back", "shipping": "delivery"}
},
"urgency": {
"type": "score",
"instructions": "How urgent is it?",
"criteria": ["not urgent", "somewhat urgent", "very urgent"]
}
}
}'
{
"model": "typesafe/jev-1.13-20260917",
"answers": {
"route": {
"type": "choice",
"choice": "refunds",
"probabilities": {"sales": 0, "refunds": 1, "shipping": 0},
"confidence": 1
},
"urgency": {
"type": "score",
"score": 1.09,
"legend": {"0": "not urgent", "1": "somewhat urgent", "2": "very urgent"},
"probabilities": {"0": 0.03, "1": 0.85, "2": 0.12},
"confidence": 0.78
}
},
"usage": {"input_tokens": 377, "output_tokens": 55}
}

The answer to each question is in answers under the same key the question was sent with.

You do not need a separate SDK; any HTTP client will do:

import os
import httpx
response = httpx.post(
"https://api.waibee.com/v1/systemone",
headers={"Authorization": f"Bearer {os.environ['WAIBEE_API_KEY']}"},
json={
"model": "jev-latest",
"state": "Customer writes: I want my money back for order 1042",
"questions": {
"route": {
"type": "choice",
"instructions": "Which team handles this ticket?",
"criteria": {"sales": "buying", "refunds": "money back", "shipping": "delivery"},
},
},
},
timeout=30,
)
response.raise_for_status()
route = response.json()["answers"]["route"]
print(route["choice"], route["confidence"])

The TypeSafe SDK works with Waibee without changes to the calling code: set the Waibee key and address. The SDK appends /v1/systemone to the address itself, so give the address without /v1.

from typesafe_sdk import Noul, TypeSafeClient
with TypeSafeClient(api_key="sk_live_...", base_url="https://api.waibee.com") as client:
result = client.system_one(
"I was charged twice.",
{"billing": Noul(instructions="Is this about billing?")},
)
print(result.nouls["billing"].noul)

Instead of arguments, you can use the TYPESAFE_API_KEY and TYPESAFE_BASE_URL environment variables. The SDK’s default model is jev-latest, and the router accepts it as is.

client.models.list() does not work with Waibee: GET /v1/models responds in OpenAI format, while the SDK expects TypeSafe format. To list decision models, use GET /v1/models?output_modalities=decisions.

FieldWhat it sets
modelThe ID of a decision class model from the catalog. An ID without the provider is read as a TypeSafe model: jev-latest is typesafe/jev-latest
stateWhat to evaluate: a string, a JSON object, or an array
questionsA “key → question” map with at least one question. You choose the keys
pluginsDLP settings, as in chat requests

A question has three fields:

FieldWhat it sets
typechoice, score, or noul
instructionsRequired. What is being asked: a string, a JSON object, or an array
criteriaOptions or levels; the shape depends on the type

The router drops other fields, at the top level and inside a question, and does not pass them to the model.

typeWhat the question askscriteriaWhat the answer contains
choiceWhich option from a set fitsAn “option → when to choose it” objectchoice with the key of the chosen option, probabilities across options, confidence
scoreWhich level of a scale fitsAn array of levels, from lowest to highestscore on the scale of level numbers, legend with a description of each number, probabilities across levels, confidence
noulWhether a statement is trueOptional: an object with the keys true and falsenoul, the probability that the statement is true, from 0 to 1

An option or level description, like instructions, can be a string, a JSON object, or an array. The model checks how many options and levels are allowed and what else a question requires: a question that breaks its rules is rejected with 400. How to phrase questions and read probabilities is covered in the TypeSafe documentation.

  • model names the version of the model that responded. With jev-latest, it is a specific version, for example typesafe/jev-1.13-20260917.
  • answers has an entry for each key in questions, in the form the model returned it.
  • usage has tokens only: input_tokens and output_tokens. output_tokens is present only if the model returned it. If the model returned no counters, the response has no usage.
  • plugins.dlp is present if DLP in mask or alert mode found something; see DLP.
  • Text volume is limited to 15 MB for state and the questions together. Their whole JSON counts: keys, quotes, and type fields are included, unlike in chat requests, where only the text counts. Going over returns 413 with the code text_content_too_large; see Limits.
  • Nesting of state, instructions, and option descriptions: no deeper than 64 levels. A deeper request is rejected with 422 and the code validation_error.
  • Decision models only. A model of another class on this endpoint is rejected with 400 and the code model_endpoint_mismatch, and so is a decision model on the chat endpoints.
  • No waibee/auto. Autorouting picks only among chat models, so waibee/auto is rejected here with 400 and the code feature_not_supported.
  • No streaming. The response always arrives in full.

Your key’s DLP policy and the plugins.dlp field work here the same way as for chat; see Plugins. Since there are no messages here, a few things differ:

  • Each string in state, instructions, and criteria is checked the same way as a user message. Keys are checked too: question keys and any object key inside state, instructions, and criteria. Numbers are checked; booleans are not.

  • A finding names the path to the string, and its message_index is -1:

    Where it was foundlocation
    state as a stringstate
    A field inside statestate.customer.email
    An element of a state arraystate[2]
    A question’s instructionsquestions.route.instructions
    An option descriptionquestions.route.criteria.sales
    A scale levelquestions.urgency.criteria[1]
    An option keyquestions.route.criteria{sales}
    A key inside statestate.customers{[email protected]}
    A question keyquestions{route}
  • report_scope narrows nothing: the response has all findings, and block rejects the whole request with 403 and the code dlp_violation.

  • With mask, the model receives a token instead of the value found. The value is restored in the response: if the response quotes your text, as legend does for score, you see your own words.

  • A direct mask or block finding in a key or number rejects the request with 403 dlp_violation. A protected value repeated in a state key or number hides its containing object and keeps the request going. In questions, the response names questions and options by their keys, so a repeated value in a key or number also gives 403 dlp_violation with a safe place name. Under alert, the request stays unchanged and the finding is reported.

Errors come in Chat Completions format: an error object with the fields code, message, and extra. Codes are shared across all endpoints: Errors.