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.
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.
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.
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.”
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.
A first recipe you can hold in your head
- One state: the ticket, trace, or passage — filtered.
- Fan-out: queue Choice, urgency Score, escalate Noul, plus two speculative Nouls you might ignore.
- Gate: auto-route only if confidence (or P(yes) on a Noul) clears a threshold you measured.
- 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.”
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.
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.
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.
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.
RAG passage filter
Score each retrieved passage. Keep useful ones, flag contradictions, drop hidden instructions. Filtering happens in code.
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.
Function calling
Map a natural-language request onto ordinary typed functions: Choice for the name and closed-set arguments. No JSON coaxing.
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.
Hierarchical classification
Beam search over Choice probabilities down a predefined tree (patents, products, code). You own the taxonomy.
Structure recovery
Rebuild Markdown from flattened text: stitch lines, then Choice block types with companion Nouls read only when relevant.
Self-consistency: Nouls
Route uncertain Noul probabilities to human review while keeping the underlying noul values visible.
Self-consistency: Choices
Add an uncertain outcome to moderation decisions and compare label agreement with the share of automatic actions.
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.
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.
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.
Pre-parsed value extraction
Regex finds candidate emails, phones, and amounts; TypeSafe selects the requested span so code can normalize a verbatim value.
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.
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.
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.”