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.

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

13 questions over the GDPR Wikipedia page in one call. Cookbook claim: 12.2× cheaper and 10.0× faster than asking them one-by-one, same answers.

Cookbook ↗

Cookbook claim

Re-ranking

30-passage BM25 shortlists × 40 legal queries, then one question per pair. Cookbook claim: top-1 5% → 18%, top-10 38% → 62%. One domain, one test.

Cookbook ↗

Official cookbook

LLM guardrails

One request screens messages in and out: Nouls for hazards (“is this a jailbreak?”) plus a Score for harm. Your code pass / review / block / routes.

Cookbook ↗

Official cookbook

Citation check

A Choice asks whether the quoted context supports the claim. Confidence can send the citation to a human. Cookbook plants failures on one document — treat as a demo.

Cookbook ↗

Official cookbook

RAG passage filter

Score each retrieved passage. Keep useful ones, flag contradictions, drop hidden instructions. Filtering happens in code.

Cookbook ↗

Official cookbook

Date extraction

Choice over months and days (“not stated” is an option). Code assembles and compares. Matches the jaggedness rule: dates are text to Jev.

Cookbook ↗

Official cookbook

Function calling

Map a natural-language request onto ordinary typed functions: Choice for the name and closed-set arguments. No JSON coaxing.

Cookbook ↗

Official cookbook

Skill suggestion

Pick at most one skill from a large catalog. Choice ranks; Nouls decide whether to suggest anything. Official reminder: Choice and Noul are not interchangeable numbers.

Cookbook ↗

Official cookbook

Hierarchical classification

Beam search over Choice probabilities down a predefined tree (patents, products, code). You own the taxonomy.

Cookbook ↗

Official cookbook

Structure recovery

Rebuild Markdown from flattened text: stitch lines, then Choice block types with companion Nouls read only when relevant.

Cookbook ↗

Official cookbook

Self-consistency: Nouls

Route uncertain Noul probabilities to human review while keeping the underlying noul values visible.

Cookbook ↗

Official cookbook

Self-consistency: Choices

Add an uncertain outcome to moderation decisions and compare label agreement with the share of automatic actions.

Cookbook ↗

Official cookbook

Line-by-line search

Score 218 GitHub ToS line ids against a plain-language query with a Choice, plus a Noul for whether the document contains an answer.

Cookbook ↗

Official cookbook

Entity alignment

Score 450 candidate pairs from two beer catalogues. Three levels: merge, leave unlinked, or hand to a curator. Official note: no threshold to fit.

Cookbook ↗

Cookbook claim

SDE cascade

Two-stage structured-data-extraction cascade (mini → verify → reasoning). Cookbook framing for quality-vs-cost — treat as a recipe, not a public bench.

Cookbook ↗

Official cookbook

Pre-parsed value extraction

Regex finds candidate emails, phones, and amounts; TypeSafe selects the requested span so code can normalize a verbatim value.

Cookbook ↗

Official cookbook

Classification using confidence

Classify SEC annual reports into 75 industry groups with one Choice each, then read confidence to report the group or the broader division.

Cookbook ↗

Official cookbook

Autoresearch feature discovery

Propose TypeSafe questions, turn free text into numeric features, and use model errors to improve a supervised CatBoost regressor. Advanced — not a first-week recipe.

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.