What is Jev, and why use it?
Jev is an AI (artificial intelligence) model from TypeSafe. It picks from allowed answers and returns probabilities. This example chooses a support team and sends uncertain cases to a person.
The probabilities are demo values and the 90% limit is our policy. No live inference or speed comparison was measured. An allowed answer can still be wrong.
Understand it. Then fix it.
A model by TypeSafe. It picks an answer.
Jev is TypeSafe's decision model. Give Jev text, a question, and a list of answers. It picks one and gives probabilities: numbers that show how likely it thinks each answer is. Choose an answer instead of writing a reply.
One message. Who should help?
The customer says, I paid twice. This server code asks who should help: payments, tech support, or someone else. Code on your server · @typesafe-ai/sdk 0.6.0.
const team = choice("Who can help?", {
payments: "Money problems",
tech: "App problems",
other: "Neither team fits",
});
const result = await client
.systemOne({
state: "I paid twice.",
questions: { team },
});Pick a limit. Ask for help below it.
No. These are demo numbers. Point nine six means ninety-six percent. We chose ninety percent as our limit. Below it, or for other, our code asks a person. Our rule · test the limit · check for errors.
const { choice, probabilities } =
result.answers.team;
const limit = 0.9;
const nextStep =
choice === "other" ||
probabilities[choice] < limit
? "ask a person"
: choice;Several questions. At the same time.
Jev answers questions together when one does not need the other's answer. It does not write a reply piece by piece. This can save time, but check the speed yourself. How TypeSafe describes Jev · no speed test here.
You still have a choice.
A chat model can choose from a list too. Use one if you also need text. Test your choice and your limit on real messages. An allowed answer can still be wrong. Test on your own messages.
Code blocks are teaching excerpts. Keep the surrounding error handling and application requirements.
Save the code excerpts ↓Read the full transcript
Why use Jev, an AI that doesn't write? Jev is TypeSafe's decision model. Give Jev text, a question, and a list of answers. It picks one and gives probabilities: numbers that show how likely it thinks each answer is. The customer says, I paid twice. This server code asks who should help: payments, tech support, or someone else. So if it picks payments, do we just trust it? No. These are demo numbers. Point nine six means ninety-six percent. We chose ninety percent as our limit. Below it, or for other, our code asks a person. Jev answers questions together when one does not need the other's answer. It does not write a reply piece by piece. This can save time, but check the speed yourself. A chat model can choose from a list too. Use one if you also need text. Test your choice and your limit on real messages. An allowed answer can still be wrong. So it can send my problem to the wrong team. Great. Now two teams can ignore me.