Decisions
Decisions (Jev)
Ask typed questions about your data and get answers your code can act on: the probability of yes, one option from a set, or a place on a scale, with calibrated probabilities, usually in under a second. Served on TypeSafe’s own API, so its SDKs work unchanged.
/v1/systemoneJev is TypeSafe’s decision model, which it calls a System One model: it understands natural language like a chat model, but instead of writing text it answers the questions you define. jev-latest, jev-1.14.0 and typesafe/jev-1.14 work as model IDs too, and jev-1.13 stays available for prompts tuned on it.
Ask questions
# pip install typesafe-sdkfrom typesafe_sdk import Choice, Noul, Score, TypeSafeClientwith TypeSafeClient( base_url="https://api.zurelay.com", api_key="YOUR_ZURELAY_KEY", model="jev-1.14",) as client: response = client.system_one( state={"ticket": "I was charged twice for October, please refund one today."}, questions={ "refund": Noul(instructions="Is the customer asking for money back?"), "team": Choice( instructions="Which team should handle this?", criteria={"billing": "Charges and refunds", "technical": "Bugs and outages"}, ), "urgency": Score( instructions="How urgent is it?", criteria=["can wait", "this week", "today"], ), }, )print(response.nouls["refund"].noul) # 0.98print(response.choices["team"].choice) # billingprint(response.scores["urgency"].score) # 1.9With TypeSafe’s SDKs, set the base URL to https://api.zurelay.com, without /v1: they add /v1/systemone themselves. The TYPESAFE_BASE_URL and TYPESAFE_API_KEY environment variables work too. Any HTTP client works the same way: send your Zurelay key as a Bearer token.
The answer
{ "id": "req_8Kq2vXbN4tR7mWc1pLs9dYe3", "model": "jev-1.14", "answers": { "refund": { "type": "noul", "noul": 0.98 }, "team": { "type": "choice", "choice": "billing", "probabilities": { "billing": 1.0, "technical": 0.0 }, "confidence": 1.0 }, "urgency": { "type": "score", "score": 1.9, "legend": { "0": "can wait", "1": "this week", "2": "today" }, "probabilities": { "0": 0.0, "1": 0.1, "2": 0.9 }, "confidence": 0.81 } }, "usage": { "input_tokens": 396, "output_tokens": 61, "cost": 0.00001386 }}Each answer comes back under the name you gave its question. usage is what the request was billed on, and cost what it cost in US dollars. The same request can give an answer a point or two apart from one call to the next.
Parameters
modelstringrequiredjev-1.14,jev-latest(the same model) orjev-1.13.statestring, object or arrayrequired- The content to decide about: a text, or structured data such as a record, a chat log or your app’s current state. Refer to a field in a question by its name in backticks, such as `ticket`.
questionsobjectrequired- Your questions, each under a name you choose. The answers come back under the same names, and the names aren’t sent to the model.
typestringrequirednoul,choiceorscore.instructionsstring, object or arrayrequired- The question. An object can hold the question in one field and data it refers to in others.
criteriaobject or array- For a
choice(required): an object of options, each with a description ornull, up to 255. For ascore(required): an array of 2 to 10 levels, lowest first. For anoul(optional):trueandfalse, what a yes and a no mean.
Question types
One request can mix all three, and asking many questions costs little more than one: the state is read once, and every question is answered against it in parallel.
Limits
- Up to 64K tokens a request, the state and every question together, and 32K for the state plus the longest question.
- Text only: a string, a JSON object or an array. Turn images, PDFs or audio into text first.
- No streaming: the answers come back whole, usually in under a second.
- A malformed request (a missing
instructions, a score with one level) is refused with a400before it reaches the model, and costs nothing. So is one over 64K tokens, with the codecontext_length_exceeded.
Getting good answers
Paying for decisions
Jev is billed on the input tokens it counts: your state and questions, plus about 270 tokens of its own on every request. The answers are free, as at TypeSafe. A short request of about 300 tokens costs about $0.00001, so a million of them cost about $10. Each reply’s usage and x-zurelay-input-tokens header say what it was billed on, every request is in your request log, and requests that fail cost nothing.
Try your own content and questions in the dashboard’s Playground: pick Jev, paste the content, set the questions beside it, and its Get code button writes the same request in Python, Node.js or cURL.
Questions, or something missing? Ask our support team and we’ll answer by email, usually within a minute.