What Are the TypeSafe Cookbooks in 2026?
The cookbooks are end-to-end recipes showing TypeSafe applied to real problems, from a few questions to full pipelines. Each one is a worked example with a real dataset, the questions that decide something about it, and the code that turns those decisions into a working system. There are 18 of them in 2026, grouped into five categories and labelled beginner, intermediate or advanced.
TypeSafe's own framing is that you read one when you want to see how the primitives and patterns come together on a concrete problem, or copy one as the starting point for your own. The prerequisite it states is that you already know the primitives and understand how confidence works.
Explain It Like I Am Five: Why Recipes Beat Instructions
There are two ways to learn to cook.
Someone can hand you a list of ingredients and say "flour is for structure, eggs are for binding, sugar is for sweetness". All true. All useless when you are hungry and standing in a kitchen.
Or someone can hand you a recipe for a cake. Exact amounts. Exact order. Exact oven temperature. Somebody already burnt the first three cakes so you do not have to.
These cookbooks are the second kind. Each one is a whole finished dish. Here is the real data, here are the exact questions, here is the code, here is what came out.
And here is the nice thing about recipes. Once you have made a cake, you can make a slightly different cake. You can swap the fruit. The recipe taught you the shape, and the shape works for hundreds of other cakes.
So the best way to learn this is not to read every page of the manual. Find the recipe closest to your problem, cook that, and then change one ingredient at a time.
Which Cookbooks Cover Guardrails and Verifying Other AI?
This is the group with the clearest commercial logic in 2026, because it puts a cheap decision model around an expensive generative one. TypeSafe describes the category as universal verification: verifying the input prompt, extractions, reasoning traces, tool calls, or inputs of any other AI, detecting jailbreaks, citation errors, hallucinations and other error modes at a fraction of the cost of the model call itself.
| Cookbook | What it does | Primitives | Level |
|---|---|---|---|
| Guardrails for LLMs | Screens every message going into and out of an LLM app with one request, thresholding hazard probabilities and severity to pass, review, block, or route | Several Nouls plus one Score | Intermediate |
| Double-checking citations | Catches wrong or hallucinated citations by checking against the source document, with one question deciding whether the quote's context supports the claim | Choice | Beginner |
| Classifying RAG passages | Scores each retrieved passage with one request, then decides in code which ones reach the answering model | Score | Intermediate |
The guardrails recipe is worth reading closely even if you never use it verbatim, because its structure is reusable. One Noul per hazard, such as whether a message attempts a jailbreak, requests harm, gives a diagnosis or dosage, or raises self-harm, plus one Score for severity. Each hazard has an action threshold and a lower review threshold, so a message either triggers its configured action, goes to a human, or passes. The severity score has its own threshold and can turn a review into a block. TypeSafe notes you edit it in two places: the dictionary of hazard questions and the two named routing policies.
That two-places design is the lesson. Everything a reviewer needs to argue about lives in two constants, not scattered across a codebase.
Which Cookbooks Cover Search, Retrieval and Reranking?
Three, and they are the strongest evidence in the documentation that this is not just a classification tool. The reranking cookbook in particular publishes before and after numbers on a public dataset.
| Cookbook | What it does | Reported result | Level |
|---|---|---|---|
| Re-ranking | Builds 30-passage keyword shortlists for 40 CLERC legal queries, then uses one question per query-candidate pair | Top-1 accuracy from 5 percent to 18 percent; top-10 from 38 percent to 62 percent | Beginner |
| Line-by-line search | Semantic search over GitHub's Terms of Service, scoring 218 line IDs against a plain-language query in one request | Also uses a Noul to check whether the document contains an answer at all | Beginner |
| Knowledge graph entity alignment | Decides which of 450 candidate pairs from two beer catalogues describe the same product | One Score plus three companion Nouls that surface which fields disagree | Beginner |
Two design details generalise beyond these recipes. The line-by-line search recipe asks a separate Noul about whether the document contains an answer at all, which is the difference between a search system that returns the least-bad line and one that can say there is nothing here. And the entity alignment recipe pairs a Score with Nouls that explain which fields disagree, so a human reviewing a near-match sees why rather than just a number.
Which Cookbooks Cover Extraction?
Three, and all of them share a principle that is easy to miss: do not ask the model to produce the value, ask it to choose the value. TypeSafe states this directly in its jaggedness notes, recommending that when the answer space is bounded you turn extraction into a Choice over options rather than asking for the value itself, and that for data extraction it is better to find candidates with a regular expression or a generative model and let Jev pick the correct one.
| Cookbook | What it does | Level |
|---|---|---|
| Date extraction | Extracts absolute and relative dates by asking for the parts named in a document, then resolving and validating them in code with confidence-based review | Beginner |
| Pre-parsed value extraction | Uses regular expressions to find candidate emails, phone numbers and amounts, then has TypeSafe select the requested span so code can normalise a verbatim value | Beginner |
| SDE cascade | A two-stage structured data extraction cascade, mini then verify then reasoning, to get most of the quality of a big reasoning model at a fraction of the cost | Intermediate |
The date recipe is the clearest illustration of the principle. Every part of a date is a small closed set: twelve months, thirty-one possible days, a bounded range of years. That turns extraction into a Choice over enumerated options rather than free-form parsing, and it gives you somewhere to put an explicit "not stated" option so a missing part is reported rather than guessed. Code then assembles the parts into a real date and owns everything after that, including ordering, duration and weekday, because Jev reads dates as text rather than as ordered quantities.
The pre-parsed recipe inverts the usual division of labour in a way worth stealing: the regular expression does the finding, which it is perfect at, and the model does the choosing, which it is good at and the regex cannot do. Normalisation then happens in code on a verbatim span, so nothing is invented anywhere in the chain.
Which Cookbooks Cover Classification?
Three, covering a flat taxonomy with confidence, a deep hierarchy, and a machine learning feature loop.
| Cookbook | What it does | Level |
|---|---|---|
| Classification using confidence | Classifies SEC annual reports into 75 industry groups with one Choice each, then reads the answer's own confidence to decide whether to report that group or the broader division above it | Beginner |
| Hierarchical classification | Classifies documents through deep patent, retail product, biomedical and source-code hierarchies using parallel beam search over Choice probabilities | Intermediate |
| Autoresearch feature discovery | Runs a loop that proposes questions, converts free text into numeric features, and uses model errors to improve a supervised CatBoost regressor | Advanced |
The confidence-based classification recipe deserves particular attention because the idea is elegant and transfers everywhere. When the model is confident, report the specific industry group. When it is not, report the broader division above it. Instead of a wrong specific answer or no answer at all, you return a correct less-specific answer. Any taxonomy with levels can do this, and it turns uncertainty into useful precision rather than a failure.
The hierarchical recipe is the one for large taxonomies. Rather than committing to a single greedy path down the tree, it runs a beam search over Choice probabilities, keeping the best K candidate paths at each level. TypeSafe's Choice documentation recommends this approach whenever you are classifying through a deep hierarchy or a large taxonomy.
The autoresearch recipe is the most ambitious and the only one labelled advanced. It uses Jev's probabilities as features for a classical machine learning model, proposing questions, turning text into numbers, and using the downstream model's errors to improve the feature set. That is also the documented answer to "can I customise Jev", since there is no fine-tuning: you train something else on its outputs.
Which Cookbooks Cover Tool Use, Formatting and Self-Consistency?
| Cookbook | What it does | Level |
|---|---|---|
| Function calling | Turns natural-language trading requests into calls to ordinary typed functions by mapping function names and closed-set arguments to confidence-aware questions | Intermediate |
| Skill suggestion | Picks at most one skill for an agent turn out of the 182 in Nous Research's Hermes catalogue, using two requests to rank and re-check the top candidates | Intermediate |
| Structure recovery | Reconstructs Markdown from plain text that lost its formatting, in two requests: one stitches hard-wrapped lines back together, one classifies every block as heading, list, code or callout | Beginner |
| Parallel questions | Runs a 13-question regulatory briefing over the GDPR Wikipedia article to measure the cost and speed of batching | Beginner |
| Self-consistency: nouls | Routes uncertain probabilities to human review while keeping the underlying noul values visible | Beginner |
| Self-consistency: choices | Adds an uncertain outcome to moderation decisions and compares label agreement with the share of automatic actions | Beginner |
The function calling recipe is the interesting one conceptually, because it treats tool selection as classification rather than generation. Function names become Choice options, closed-set arguments become their own questions, and confidence gates whether the call fires. That removes the failure mode where a generative model invents a function that does not exist or an argument the schema does not accept.
The skill suggestion recipe is one of only three in the whole documentation set that legitimately makes two requests. It ranks 182 skills in the first request, then fetches the full text of the top three and judges them again against that better evidence. It also uses a Choice and Nouls together on the same shortlist, the Choice to pick a skill and the Nouls to decide whether to suggest one at all, which is exactly the distinction TypeSafe draws between a relative and an absolute question.
The parallel questions recipe is the cheapest 10 minutes in the documentation. One batched call at 0.000497 US dollars and 0.27 seconds against 13 separate calls at 0.006090 US dollars and 2.71 seconds: 12.2 times cheaper and 10.0 times faster with no change in answers.
Which Cookbook Should You Start With in 2026?
Match the recipe to the problem you already have rather than to the one that sounds most impressive. The mapping below is by job rather than by category.
| If your problem is... | Start with | Why |
|---|---|---|
| An LLM product that sometimes says something it should not | Guardrails for LLMs | One request screens input and output; thresholds live in two constants |
| RAG answers citing the wrong passage | Double-checking citations, then classifying RAG passages | One verifies the output, the other improves the input |
| Search that returns nearly-right results | Re-ranking | Published before and after numbers on a public dataset |
| A large category tree nobody can classify into reliably | Classification using confidence, then hierarchical classification | Start flat with a fallback to the parent, then go deep with beam search |
| Fragile regex or parsing code for dates and fields | Date extraction and pre-parsed value extraction | Regex finds candidates, the model chooses, code normalises |
| An agent choosing the wrong tool | Function calling, then skill suggestion | Tool choice as classification with a confidence gate |
| Moderation with too much or too little automation | Self-consistency: choices | Compares label agreement against the share of automatic actions |
| A cost or latency problem you cannot explain | Parallel questions | It is almost always the number of calls, not the model |
What Are the Common Mistakes When Copying a Cookbook in 2026?
- Copying the questions verbatim. The instructions and criteria encode the cookbook's domain, not yours. The structure transfers; the wording does not.
- Keeping the thresholds. Every threshold in every recipe was chosen against that dataset. Re-derive yours from your own labelled sample.
- Skipping the prerequisites. TypeSafe states the cookbooks assume you know the primitives and understand confidence. They read very differently if you do not.
- Reading the reported numbers as your expected results. Top-1 accuracy rising from 5 to 18 percent is a result on CLERC legal queries with a specific shortlist, not a promise about your corpus.
- Adopting the two-request recipes as a default. Only three recipes make a second call, each for a documented reason. One request is the norm.
- Asking the model to generate the extracted value. The extraction recipes all have the model choose among candidates instead. That is deliberate.
- Starting with the advanced one. The autoresearch feature discovery loop is genuinely advanced and assumes a supervised model with ground truth already in place.
Key Takeaways for 2026
- 18 official cookbooks in five groups: self-consistency, batching, how-to, extraction and classification, labelled beginner through advanced.
- The guardrails recipe is the strongest commercial pattern: a cheap decision model screening an expensive generative one, with thresholds in two constants.
- Re-ranking reports top-1 accuracy rising from 5 percent to 18 percent and top-10 from 38 percent to 62 percent on 40 CLERC legal queries.
- Every extraction recipe has the model choose among candidates rather than produce the value, because bounded answer spaces suit a Choice.
- Classification using confidence returns the broader parent category when the specific one is uncertain, which turns uncertainty into precision.
- Only three recipes make a second request, and each has a documented reason for it.
- Copy the structure, re-derive the thresholds, and rewrite the questions for your own domain.
Distk adapts these recipes to commercial workflows, which mostly means rewriting the questions for the client's domain and re-deriving every threshold against their own labelled data rather than inheriting the cookbook's.