What it is
Jev answers questions your code defines, with a probability for every answer
Most of the AI inside ordinary software is making small decisions. Which team should get this ticket, and is the customer angry enough that somebody should call them back? The usual way to answer a question like that today is to send the text to an LLM and ask it to reply in JSON. Your code then has to parse what comes back and check that it matches the shape you asked for, because the model can write anything.
Jev takes two inputs:
- The state is the content you want judged. It can be plain text, and it can be JSON when the decision needs several pieces together, like a customer's message alongside your refund policy.
- The questions each carry a type and the full list of answers they are allowed to return, filed under an ID you choose so your code can find the answer again.
There are three question types, and each returns a different shape of answer.
| Type | What it asks | What comes back |
|---|---|---|
| Choice | Which of these options fits? Up to 255 options, each with a description you write. | choice (the most likely option), probabilities for every option, and confidence |
| Score | Where does this sit on a scale? You describe 2 to 10 ordered levels. | score, the probability-weighted average of the level numbers, plus probabilities and confidence |
| Noul | Is this statement true? | noul, the probability that the answer is yes |
TypeSafe's quickstart sends one support message, "Hi, I've been trying to connect my Stripe account for 3 days and it keeps failing. I'm losing sales. Please help ASAP.", with three questions. The department question is a Choice between billing, technical and sales. The frustration question is a Score with three levels, from "Calm, just stating facts" (0) to "Very angry, strong language" (2). The is_urgent question is a Noul. This is the answer from the docs, with the Score's legend field left out:
{
"model": "jev-latest",
"answers": {
"department": {
"type": "choice",
"choice": "billing",
"probabilities": {"billing": 0.84, "technical": 0.159, "sales": 0.001},
"confidence": 0.596
},
"frustration": {"type": "score", "score": 1.035, "confidence": 0.842},
"is_urgent": {"type": "noul", "noul": 0.999}
},
"usage": {"input_tokens": 312, "output_tokens": 48}
}Billing wins with 0.84, but technical still gets 0.159, because a Stripe connection that keeps failing could be a payment problem or an integration bug. The frustration score of 1.035 sits just past level 1, "Frustrated but civil". The message is almost certainly urgent at 0.999. Your code branches on these numbers the way it would branch on any other value, which is why TypeSafe's launch post describes these calls as "smart if-statements".
Keep reading
The rest of this article is free with an account
Create a free account to read the remaining 6 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.
- 02It fits the small decisions inside software that run thousands of times a day
- 03Jev reads the state once and answers every question in parallel
- 04The version you'll see is jev-1.13, through TypeSafe's API only
- 05The shape of the answer decides whether Jev or an LLM fits the job
- 06How to try it
- and 1 more
