Jev API quickstart: make a typed decision with Python
Install TypeSafe AI's Python SDK, ask Jev a Choice and Noul question, and use the answers in a simple support-routing workflow.
What this example does
Suppose a support team receives a short customer message. It needs to choose a queue and decide whether the message sounds time-sensitive. Jev can answer both questions about the same message in one request. Your application decides what to do with the results.
TypeSafe AI calls Jev a System One model. Its API takes a state and one or more typed questions, then returns answers under the question IDs you supplied. This example uses a Choice for the queue and a Noul for urgency.
Install and keep the API key on the server
Use Python 3.10 or later and install the official SDK with pip install typesafe-sdk. Create an API key in the TypeSafe dashboard and set TYPESAFE_API_KEY in the environment where your server code runs. The SDK reads that variable automatically. Never put this key in browser JavaScript or a public repository.
Ask two focused questions
The categories below are an example, not built-in Jev labels. Change them to match the queues your team actually uses. Each question asks for one judgment about the same input.
from typesafe_sdk import Choice, Noul, TypeSafeClient
message = "I cannot sign in and need access before today's meeting."
client = TypeSafeClient()
result = client.system_one(
state=message,
questions={
"queue": Choice(
instructions="Which support queue best fits this message?",
criteria={
"accounts": "Sign-in or account access problems",
"billing": "Charges, payments, or invoices",
"other": "Anything else",
},
),
"urgent": Noul(
instructions="Does the message describe a time-sensitive need?",
),
},
)
print(result.answers["queue"].choice)
print(result.answers["urgent"].noul)Read the answer correctly
The queue answer's choice is one of the keys you defined, such as accounts or billing. The Noul answer is a number from 0 to 1 for the truth of the urgency question. It is not a separate confidence field. Choice answers also include confidence and probabilities; inspect those if your workflow needs a review rule.
Do not assume the printed values will match a sample exactly. Test your categories with real examples, including messages that fit no queue cleanly. For actions with meaningful consequences, route uncertain cases to a person and measure errors before automating them.
Next step for a production workflow
Keep the original message, returned answer, and eventual human correction together so you can evaluate the routing rule. Define a fallback if the API fails, and use ordinary application code to turn the typed answer into a queue assignment. For more on the three answer shapes, read our Choice, Score, and Noul guide.
Source: TypeSafe AI Python quickstart ↗. This directory is independent and its explanations are editorial summaries, not TypeSafe AI documentation.
Related: Compare Choice, Score, and Noul.