Jev examples
Here are copy-paste Jev examples for the patterns people actually use — classify, route, score, judge, and gate — each a single call to the decide endpoint that returns a typed answer you branch on. Every snippet uses the real request shape, so you can paste it, add a jv_live_ key, and run it.
Every example is one POST to https://jevtypesafeai.com/api/v1/decide with { state, questions } and reads the typed answers map back. A choice returns answers.<q>.choice (one of your criteria keys), a score returns answers.<q>.score, and a noul returns answers.<q>.noul (a calibrated 0–1 probability); choice and score also carry answers.<q>.confidence.
Classify / route (choice)
// Route a support ticket to a queue
const res = await fetch("https://jevtypesafeai.com/api/v1/decide", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${process.env.JEV_KEY}` },
body: JSON.stringify({
state: { ticket: text },
questions: {
queue: { type: "choice", instructions: "Which queue should this go to?",
criteria: { billing: "payments", technical: "bugs", abuse: "spam/fraud", sales: "pricing" } },
},
}),
});
const { answers } = await res.json();
route(answers.queue.choice); // one of your four criteria keysRate on a scale (score)
// Score lead quality on an ordered scale
body: JSON.stringify({
state: { lead },
questions: {
quality: { type: "score", instructions: "Rate this lead.",
criteria: ["cold", "warm", "hot", "priority"] },
},
}),
// → answers.quality.score is the index on your scale (0–3), with answers.quality.confidenceYes / no gate (noul)
// Gate a risky agent action before it runs
body: JSON.stringify({
state: { action, context },
questions: {
safe: { type: "noul", instructions: "Safe and reversible to run without a human?" },
},
}),
// → answers.safe.noul is a calibrated 0–1 probability: if (answers.safe.noul > 0.85) run();Several decisions in one call
// Judge an answer on two axes plus a flag — one round trip
body: JSON.stringify({
state: { question, answer },
questions: {
verdict: { type: "choice", instructions: "Is the answer correct?",
criteria: { correct: "right", partial: "partly", wrong: "incorrect" } },
quality: { type: "score", instructions: "Rate quality.", criteria: ["poor", "ok", "good", "great"] },
escalate: { type: "noul", instructions: "Send to a human?" },
},
}),
// → answers.verdict.choice, answers.quality.score, answers.escalate.noulSee them running
Each pattern above is live on this site: PR Judge (judge), Model Router (route), Fraud Email Detector (classify), and more in the tools gallery. Open one, then paste the matching snippet into your own code.
FAQ
What's the basic shape of a Jev call?
A POST to /api/v1/decide with { state, questions }. Each question has a type (choice, score, or noul), instructions, and — for choice/score — criteria. The response is { answers }, where answers.<name> holds .choice, .score, or .noul plus (for choice/score) .confidence.
Do I read .key or .choice from the response?
A choice question returns answers.<name>.choice (one of your criteria keys), not .key. score returns .score, noul returns .noul. Reading top-level fields or .key won't work — the answers are nested under answers.
Can I ask several questions at once?
Yes — put multiple entries in questions and you get one typed answer for each in a single round trip, each with its own confidence. That's usually cheaper and faster than separate calls.
Where do I run these?
Anywhere that can make an HTTPS POST — Node, Python, the browser, an edge function. Try the patterns free in the browser playground first, then add a jv_live_ key and paste them into your code.
See also: How to use the API · Tools (live examples) · Made with Jev · Docs · Playground
Paste one and run it
Try any example free in the browser, then grab a jv_live_ key and drop it into your code.