Lesson 06 · Jev 101

Recipes: official patterns, beginner wording

A complete 101 has to teach how decisions compose. These four patterns are TypeSafe’s, not this guide’s invention. The cookbooks are worked notebooks — we map them; we don’t re-run them.

Official index:Patterns and Cookbooks. Speed and accuracy figures below are cookbook claimsuntil you reproduce them.

The four patterns

TypeSafe’s pattern page assumes you already know the primitives and confidence. Here they are in beginner order: ask more, gate harder, score in pieces, route the rest.

Official pattern

Speculative fan-out

What. Ask many independent questions about the same state in one request — including ones you might throw away.

Why TypeSafe says it. Official docs: questions run in parallel. Extra questions add tokens, not a serial round-trip. Code keeps what it needs.

Beginner take. Don’t write a mega-prompt. Write ten small questions. Ignore the ones that don’t fire. That is the product, not a trick.

Official page ↗

Official pattern

Confidence-gated routing

What. The answer says what. Confidence says whether your code should act.

Why TypeSafe says it. Official pattern: use confidence as a second axis so high-stakes actions only fire when the model is sure.

Beginner take. High + allowed → auto. Middle → human or a slower LLM. Low → do not pretend you decided. Thresholds are yours to measure.

Official page ↗

Official pattern

Composite scoring

What. Break a fuzzy “is this a good candidate / claim / listing?” into atomic Scores or Nouls. Combine with weights in code.

Why TypeSafe says it. Official pattern: you keep the individual judgments, and you can change a weight without rewriting a prompt.

Beginner take. If the ranking looks wrong, change a number in your repo. Don’t ask Jev to “be more senior-engineer-ish.”

Official page ↗

Official pattern

Intent routing

What. Classify the incoming request, then send it to plain code, a specialist LLM, or a human.

Why TypeSafe says it. Official pattern: one intent can skip the LLM entirely. A complexity Score decides who pays for reasoning.

Beginner take. Jev is the switchboard. The handlers stay ordinary software. That is “smart if-statements,” not an agent loop.

Official page ↗

A first recipe you can hold in your head

  1. One state: the ticket, trace, or passage — filtered.
  2. Fan-out: queue Choice, urgency Score, escalate Noul, plus two speculative Nouls you might ignore.
  3. Gate: auto-route only if confidence (or P(yes) on a Noul) clears a threshold you measured.
  4. If you need a written reply, call an LLM after the decision. Jev does not write it.

That is thehow-to-build thesis: code owns control flow; System One owns the narrow judgments.

Nine cookbooks, beginner wording

The mapped list below is the full official set. These nine are the ones a first-week reader actually needs as habits. Notebooks often pinjev-1.12 and install helper code with--extra-index-url https://pypi.typesafe.ai/. Pinjev-1.13.0 when you ship.

Official cookbook

Function calling

Leave the typed functions alone. A Literal or boolbecomes a Choice or flag question. An int, free text, or date gets no question — the function default stands. Astated Noul asks whether the user mentioned that argument at all; if not, omit it. Write questions about the idea, not the parameter name (“Which resolution?” gives the command nothing to match). One request picks the function and fills every function’s args; your dispatcher reads only the winner. The call’s confidence is theleast certain judgment, not the product of all of them.

Cookbook ↗

Official cookbook

Skill suggestion

Two requests, then at most one extra system-prompt line. First: rank the whole roster (one line each) and ask whether a skill is needed at all. Second: re-read the top three with full descriptions and you may reject all of them. The agent keeps its index and its own judgment — prefix caching still holds. The vs-Haiku table in the notebook is a cookbook claim, not a TypeSafe SLA.

Cookbook ↗

Official cookbook

Classification using confidence

Read confidence, not just the winner’s probability. A 0.45 vs 0.44 race is different from 0.45 with the rest scattered — confidence is what separates them. If your labels form a hierarchy, report the parent when unsure. No second call. Cookbook: a Choice is reliable up to roughly 240 options; the Choice page still publishes 255.

Cookbook ↗

Official cookbook

SDE cascade

Jev verifies. It does not extract. A cheap LLM writes the fields; per-field Nouls ask P(this value is wrong); a reasoning model runs only if a signal fires. Official note: they skip JSON mode on purpose — a schema-following miss is not the error they expect. Install helper packages from https://pypi.typesafe.ai/.

Cookbook ↗

Official cookbook

Find, then pick, then copy

A recall-tuned regex over-finds candidate emails, phones, or amounts. Choice options are those spans plus a none hatch. Code copies the pick unchanged — Jev cannot invent a value or transpose a digit. More than 255 candidates → two stages. Names need a roster, NER, or an LLM to propose candidates first.

Cookbook ↗

Official cookbook

Nearest-level alignment

One Score whose three levels are the outcomes: leave unlinked, hand to a curator, or merge. Round to the nearest level — there is no threshold to fit. Companion Nouls ride along so the curator sees which field disagrees. Arithmetic (ABV) stays in code. Cookbook: the public endpoint rate-limits above roughly eight concurrent workers.

Cookbook ↗

Official cookbook

Date parts in code

Seven Choices in one call: how the date is written, then month / day / year / weekday. Code assembles a date. Confidence is the weakest part you actually used. “not stated” andout_of_range are options so the model does not guess a year. Matches jaggedness: dates are text to Jev.

Cookbook ↗

Official cookbook

Uncertain is an outcome

Self-consistency cookbooks keep the underlying Noul or Choice visible, then map a mid band to an explicit uncertainroute. They illustrate Noul 0.30–0.70 and a Choice top-p below 0.60. Those cutoffs are the notebook’s, not a TypeSafe SLA. vs-LLM tables are cookbook claims.

Nouls ↗ · Choices ↗

Official cookbook

You own the taxonomy

Hierarchical classification: every node is a Choice. Greedy takes the top child and cannot recover. Beam keeps K paths, scores each as a length-normalized geometric mean, and can repair an early miss. You write the tree (patents, products, code, skills).

Cookbook ↗

Official comparison tool: system-one-adapter-python is a drop-in TypeSafeClient backed by an LLM API. Same question objects, not Jev. Use it to compare — not as a substitute for the hosted model.

Batch, then rerank

Official: questions about one state ride together. Ranking a corpus is the other shape — cheap search first, then one judgment per pair.

Official cookbook

Batch the questions

One document, thirteen questions, one call. Each question is scored on its own — batching adds no bias and no extra noise. The document is paid for once. Cookbook claim on the GDPR Wikipedia page: 12.2× cheaper and 10.0× faster than thirteen serial calls (jev-1.12, 5 repeats). Not a TypeSafe SLA.

Cookbook ↗

Official cookbook

One Noul per pair

Cheap search (BM25, embeddings) builds a shortlist. One Noul per query–candidate pair; sort by that noul. Do not dump thirty passages into one state. Cookbook: one request per pair for clarity; a real app can add sibling questions about the same pair. 5%→18% top-1 is a cookbook claim.

Cookbook ↗

Official cookbook

Answers can become table columns

Autoresearch is not a first-week recipe. An LLM proposes questions; Jev answers every row; CatBoost trains. A Score becomes two columns (expected level + spread). A Noul is one probability. Held-out RMSE numbers stay with the notebook.

Cookbook ↗

Verify, filter, recover

Five more official cookbooks for the week you put Jev next to an LLM. Same pin: notebooks often say jev-1.12; shipjev-1.13.0.

Official cookbook

Citations: match, then judge

If the quote is not in the source after you normalize whitespace and curly quotes, mark it fabricated in code. No model call. Confidence is None. Surviving quotes get one Choice: supports / contradicts / says_nothing. A verbatim quote can still say nothing about the claim. Notebook AUTO_ACCEPT = 0.8 is theirs, not a TypeSafe SLA.

Cookbook ↗

Official cookbook

Guard both sides

One request per message: Nouls for each hazard, plus a Score for how much harm complying would do. Your route() decides pass / review / block / support. Run it on the prompt and on the reply. “Ignore your instructions” becomes a jailbreak score — it does not become a working jailbreak.

Cookbook ↗

Official cookbook

Filter RAG in code

Cheap retrieval first. Then one request per passage: relevant, usable evidence, contradicts the query’s premise, instructs the model. First matching rule wins: keep as evidence, keep as a conflict block, or drop. The model that writes the answer is not Jev.

Cookbook ↗

Official cookbook

Rank a line; ask if it answers

Tag every line with an ID. A Choice over those IDs always ranks something — probabilities sum to 1 even when the document has no answer. A companion Noul asks whether any line actually answers. That exists number is the real signal. More than 255 lines → two stages.

Cookbook ↗

Official cookbook

Recover structure; never rewrite

Two requests. Pass 1: one Noul per adjacent line pair — did the wrap split a sentence? Pass 2: Choice per block (heading, list, code, callout…) plus companion questions you read only when the type makes them relevant. Code renders Markdown. Every output character comes from the input. Markers stay in code.

Cookbook ↗

Official cookbooks, mapped

Each row is a named TypeSafe notebook. Open the source when you implement. Do not copy numbers onto a slide as “the benchmark.”

Cookbook claim

Parallel questions

One document + N questions in one call. Each question is scored on its own — batching adds no bias and no extra noise. The document is paid for once. 12.2× cheaper / 10.0× faster is a cookbook claim (jev-1.12, 5 repeats).

Cookbook ↗

Cookbook claim

Re-ranking

Cheap search builds a shortlist. One Noul per query–candidate pair; sort by that noul. Do not dump 30 passages into one state. 5%→18% top-1 is a cookbook claim.

Cookbook ↗

Official cookbook

LLM guardrails

One request per message, on the way in and on the way out. Nouls for each hazard plus a Score for how much harm complying would do. Your code routes pass / review / block / support. “Ignore your instructions” is a score, not a working jailbreak.

Cookbook ↗

Official cookbook

Citation check

String-match the quote first. Missing after normalize → fabricated in code, confidence None. Surviving quotes get Choice supports / contradicts / says_nothing. A verbatim quote can still say nothing about the claim. Notebook AUTO_ACCEPT=0.8 is theirs.

Cookbook ↗

Official cookbook

RAG passage filter

After cheap retrieval, one request per passage: relevant / usable / contradicts the query’s premise / instructs the model. Code keeps evidence, keeps conflicts separately, or drops. First matching rule wins. The answering LLM is not Jev.

Cookbook ↗

Official cookbook

Date extraction

Seven Choices in one call read how the date is written and which parts the text names. Code assembles the calendar. Confidence is the weakest used part. “none” and “out_of_range” are options. Notebook used jev-1.12.

Cookbook ↗

Official cookbook

Function calling

Closed-set args become Choice or flag questions. Ints, free text, and dates get no question — the function default stands. A stated Noul omits an unused arg. Call confidence is the weakest judgment, not the product of all of them.

Cookbook ↗

Official cookbook

Skill suggestion

Two requests: rank the whole roster cheaply, then re-read the top three with full text and maybe reject all of them. The winner is one extra system-prompt line. The agent keeps its index. Cookbook vs-Haiku table is a claim.

Cookbook ↗

Official cookbook

Hierarchical classification

Every node is a Choice. Greedy takes the top child. Beam keeps K paths scored by a length-normalized geometric mean so a later edge can repair an early miss. You own the taxonomy.

Cookbook ↗

Official cookbook

Structure recovery

Two requests. Pass 1: one Noul per adjacent line pair (did the wrap split a sentence?). Pass 2: Choice per block plus companion questions read only when relevant. Code renders; Jev never rewrites the words. Markers stay in code.

Cookbook ↗

Official cookbook

Self-consistency: Nouls

Repeat a 14-Noul rubric and map a mid band (they illustrate 0.30–0.70) to an explicit uncertain outcome. Keep the underlying P(yes) visible. vs-LLM table is a cookbook claim.

Cookbook ↗

Official cookbook

Self-consistency: Choices

Require a top Choice probability of at least 0.60 or send the label to review. Keep abstentions visible. Notebook: TypeSafe still flipped 2 of 8 questions before the band.

Cookbook ↗

Official cookbook

Line-by-line search

Tag lines, Choice over IDs, Noul “does any line answer?”. Choice probabilities sum to 1, so something ranks first even when the doc has no answer. exists is the real signal. More than 255 lines → two stages.

Cookbook ↗

Official cookbook

Entity alignment

One Score whose three levels ARE the outcomes: leave unlinked / curator / merge. Round to the nearest level — no threshold to fit. Companion Nouls ride along for the curator. ABV stays in code. Public endpoint rate-limits above roughly eight concurrent workers.

Cookbook ↗

Cookbook claim

SDE cascade

Cheap LLM extracts; Jev verifies with per-field Nouls for P(wrong); escalate only if a signal fires. They skip JSON mode on purpose. Notebook used jev-1.12 via cooksafe.

Cookbook ↗

Official cookbook

Pre-parsed value extraction

Recall-tuned regex over-finds spans. Choice options ARE those spans plus a none hatch. Code copies the pick unchanged — Jev cannot invent a value or transpose a digit. More than 255 candidates → two stages. Names need a roster, NER, or an LLM first.

Cookbook ↗

Official cookbook

Classification using confidence

Read confidence, not just the winner’s probability. If labels form a hierarchy, report the parent when unsure — no second call. Cookbook: Choice is reliable up to roughly 240 options. Numbers are jev-1.12 on 60 filings.

Cookbook ↗

Official cookbook

Autoresearch feature discovery

An LLM proposes questions; Jev answers every row; CatBoost trains. A Score becomes two columns (expected level + spread). A Noul is one probability. Advanced. Held-out RMSE numbers are cookbook claims.

Cookbook ↗

Official cookbook

Smart home assistant demo

Official demo of speculative fan-out: ask lights-off plus many other questions in one call; code keeps the relevant answers. A Noul detects compound requests and an LLM splits them. Source “will be on GitHub at release.”

Cookbook ↗

Still not here: a frozen SDK sample that will rot. Pinthe official quickstart the day you type. Next lesson is what Jev is bad at — read it before you automate.