Jev cheat sheet
TypeSafe AI's System One model. You define the answers, and it picks one with calibrated probabilities.
The loop
Primitives
| Type | Use for | Returns |
|---|---|---|
choice | Pick one from a fixed list | choice, probabilities, confidence |
score | Place on a rubric or scale | score, probabilities, confidence |
noul | Is a statement true? | One probability, 0–1 |
TypeScript
npm install @typesafe-ai/sdk
import { choice, score, noul, TypeSafeClient } from '@typesafe-ai/sdk'
const client = new TypeSafeClient()
const { answers, model, usage } = await client.systemOne({
state: { /* only what the decision needs */ },
questions: {
team: choice('Which team should handle this', { billing: '…', technical: '…' }),
mood: score('How frustrated the customer appears', ['Calm', 'Civil', 'Very angry']),
urgent: noul('The message conveys urgency'),
},
})
answers.team.choice · answers.team.confidence · answers.urgent.noul
HTTP: POST https://api.typesafe.ai/v1/systemone with header Authorization: Bearer <KEY>. Through the Vercel AI Gateway, the model ID is typesafe-ai/jev.
Confidence bands
choice and score. Tune them on labeled data, per confidence bucket.For a noul, use two lines (for example 0.30 and 0.70) and treat the zone between them as unsure.
Probability vs confidence: a probability belongs to one option, while confidence is the spread of the whole distribution.
Tuning the lines
Coverage is the share of traffic at or above the line. Accuracy is measured within that automatic slice only. Raising the line lowers coverage and raises accuracy.
// after collecting rows = [{ label, choice, confidence }] once, with the model version pinned
for (const t of [0.5, 0.6, 0.7, 0.8, 0.9]) {
const auto = rows.filter(r => r.confidence >= t)
const acc = auto.filter(r => r.choice === r.label).length / auto.length
console.log(t, auto.length / rows.length, acc)
}
// pick the LOWEST t with acc >= this action's target (riskier action = higher target)
Re-run when the model version, the question wording or the traffic changes. One line per action, not one per model. Sources: Copes · TypeSafe confidence routing.
Production checklist
| Pin the model | systemOne({ model: 'jev-1.13.0' }). The client default is jev-latest. |
| Latency budget | new TypeSafeClient({ timeout: 1500, retry: { maxRetries: 1 } }). Defaults are 10 s per attempt and 2 retries. |
| Fail safe | catch leads to the same exit as low confidence (triage). Never guess. |
| Log every exit | Model, choice, confidence and action. Human corrections become new labels for re-tuning. |
| Lines as constants | From your Lesson 3 table, reviewed in one place. |
Agent gates: ① guardrail (a noul per hazard plus a severity score, with review and act lines) · ② tool choice (function and arguments as choices; confidence is the weakest one) · ③ verify cascade (any noul over the line escalates to a bigger model). Sources: How to build · guardrails · function calling · cascade.
Numbers
| Latency | 70–500 ms, most ~100 ms |
| Price | $0.042 / M input tokens, output free |
| Rate limits | 80 requests/s, 100k tokens/s |
| Context | 64k tokens (state + questions) |
Writing questions: six rules
| 1Atomic | One judgment per question ID. AND / OR the answers in code. |
| 2Math in code | Jev extracts (for example a month, with a not_stated option). Code computes the number and passes a bucket. |
| 3Name state | Use object state and refer to `ticket.messages[0]` by path. Filter out irrelevant fields. |
| 4Align criteria | true is the yes case. No negations or double negatives. |
| 5Option order | Jev 1.13 leans toward the first option. Reorder and check the answer is stable. |
| 6Untrusted state | Text inside state can try to steer Jev. Use explicit criteria and test with adversarial inputs. |
Source: Jev 1.13 jaggedness.
Jev or LLM?
Jev: the answer comes from a fixed set, you make the call often, and latency or cost matters.
Code first: arithmetic, counting or dates. Compute them, then pass the result as state.
LLM: text, code, summaries, multi-hop reasoning, or rare high-stakes calls.
Jev reads instructions literally, so write them explicitly. Trim the state.