Jev AI Structured Extraction: Pick Candidates, Read Dates, Verify with a Cascade
Structured extraction is the job most teams reach for a chat model to do, and it is the job chat models are worst at: asked to return a date, an amount or an address, a generative model will return something that looks right — including a year nobody wrote, a digit transposed, a currency guessed from context. Jev’s three documented extraction recipes attack that from three directions, and all three share one rule: the model makes the judgment, the code holds the value.
This page works through those three shapes using TypeSafe’s published cookbooks — pre-parsed value extraction, date extraction and the SDE cascade — with their recorded answer values, thresholds and cost figures.
Provenance: every confidence value, probability, threshold, sample output and cost figure on this page is copied from those three cookbook pages (all run against
jev-1.14.0) and from Models, Choice, Advanced: structure and How to build with TypeSafe, read on 2026-11-10. Where the documentation shows a masked value (+141****0177), it is masked here too. Arithmetic I performed myself is labelled as derived.
The three shapes at a glance
| Shape | The model does | Your code does | Documented recipe |
|---|---|---|---|
| Pick from pre-parsed spans | Chooses which regex-found span plays the role | Copies the span verbatim, parses it into a typed value | Pre-parsed value extraction |
| Read the parts | Answers Choice questions about what the text says | Fills gaps, does calendar arithmetic, validates | Date extraction |
| Verify and escalate | Answers one Noul per rule the answer must follow | Escalates above a threshold, keeps the cheap answer otherwise | SDE cascade |
The premise underneath all three is the one TypeSafe’s build guide states as its most important concept: broad questions hide several judgments behind one answer, while atomic questions expose those judgments so you can inspect, tune and combine them in code. “Extract the invoice data” is a broad question. “Which of these four found amounts is the total the customer must pay?” is atomic, and its answer is checkable against the document.
Shape 1 — pick from spans your code already found
The pre-parsed cookbook takes three values out of one page of text: the address a sender wants their receipt sent to, a phone number, and an invoice total. The method is the same each time, in three steps:
- A regex finds the candidate values. It is tuned for recall — catch every real value, even if it also catches wrong ones.
- Jev picks which candidate the question is asking for, and reads off any attribute you need downstream: currency, country, whether an amount is a credit or a charge.
- Code copies the picked string and normalises it.
The candidates are the options of a Choice question, which is what makes invention impossible: the answer is one of the spans, copied, or the explicit none hatch. The pick helper in the cookbook builds its criteria from the candidate list plus one escape:
criteria = {c: None for c in candidates} | {
"none": "None of these is the requested value."
}
answer = ts.system_one(
state=document,
questions={"pick": Choice(instructions=question, criteria=criteria)},
model="jev-1.14.0",
).answers["pick"]
return {"choice": answer.choice, "confidence": answer.confidence}
Email: the body overrides the header
The sample thread has four addresses in it and the body asks for the receipt to go to a personal address rather than the billing alias in To:. Two questions go out against the same document: which address gets the receipt, and which one sent the message. Recorded answers:
- receipt →
jane.personal@example.net, confidence 0.97 - sender →
jane.doe@example.com, confidence 1.00
Both are copies of regex matches. Nothing was regenerated; the only transformation is the lowercase step the cookbook applies in code.
Phone: two answers feed a library
Three numbers, none with a country code. That is two separate judgments, so the cookbook asks two questions: which number is the direct mobile, and in which country is this office — the second a Choice over a fixed label set (US, GB, DE, FR, CA, AU). phonenumbers then combines the picked string and the picked country into E.164. Recorded: mobile (415) 555-0177 at confidence 1.00, country US at 1.00, formatted output +141****0177 (masked in the published page).
Note how the work is split. The text says “main desk”, “billing fax”, “my direct cell” — reading which is which is the model’s job. Assembling an international phone number is phonenumbers’ job. Neither does the other’s.
Money: pick, classify, and check the sign
The invoice carries four amounts. The cookbook picks the total due and the courtesy credit, classifies the currency over a fixed label set, and asks one Noul per picked amount — is this a credit or a refund, not a charge? Recorded results:
| Question | Picked span | Parsed | Flag | P(credit) |
|---|---|---|---|---|
| total due | $1,315.50 | 1315.50 USD | charge | 0.03 |
| courtesy credit | $50.00 | 50.00 USD | credit | 0.98 |
The two Noul answers are what give the parsed Decimal its sign. That is a real decision — a refund line and a charge line look identical to a regex.
The cookbook also flags the trap in its own parsing assumption: it treats the comma as a thousands separator and the dot as the decimal point, which holds for $1,315.50 and is reversed in €1.315,50. Its documented fix is another Noul in the same request — “Does this document use a comma as the decimal point?” — and a branch on the answer.
Two limits worth knowing before you build
- A
Choicequestion takes at most 255 options. More candidates than that means narrowing in two stages: pick the section first, then the span inside it. TypeSafe’s line-by-line search cookbook is the worked example of the first stage — tag each line with an ID and let a Choice point at the matching lines. - Finding the candidates is the real work. Emails, phone numbers and amounts have regexes that cover the space. A name does not, so its candidates must come from a roster you already hold, or from a named-entity recogniser or an LLM that proposes them. Jev’s role only starts once the option list exists.
Shape 2 — read the parts, let code do the math
Dates are where “just ask the model for the date” fails quietly. The date extraction cookbook inverts it: Jev answers Choice questions about what the text says, and Python resolves those parts into a date.
Seven questions go out in a single call. mode says how the date is written — absolute (a calendar date naming a month), relative (today, tomorrow, the day after tomorrow, or a named weekday), or none (the document does not state this date). Then month, day, year, day_anchor, weekday and week_offset read the pieces, and code reads only the pieces mode calls for.
Two details make it work:
- The year question has two escapes.
nonemeans the text states no year and code fills one in;out_of_rangemeans a year is stated but sits outside the offered 1900–2050 window, and code flags that instead of guessing. The cookbook also notes a practical simplification: if a 151-option list bothers you, pull the year-like numbers out of the text first and offer the model only those. - A date’s confidence is the weakest part it used. One shaky month read can send the whole date to review, which is the conservative direction.
The fill-in rule for a missing year is stated plainly: take the current year and move to the next one only when the date is already more than a month past. And the ambiguity in “next Thursday” is resolved by a stated convention, not by the model: a bare weekday means the next one on or after today, next means the following calendar week, current means this week.
The published scorecard
Six dates across four short documents, all resolved against a pinned TODAY of 2026-07-30 (a Thursday), with REVIEW_BELOW = 0.60:
| Question | Expected | Got | Confidence | Flag |
|---|---|---|---|---|
| the date the agreement takes effect | 2025-01-01 | 2025-01-01 | 0.87 | |
| the date the agreement expires | 2027-12-31 | 2027-12-31 | 0.97 | |
| the deadline to return the form | 2026-08-14 | 2026-08-14 | 1.00 | |
| the date of the kickoff call | none | none | 0.66 | review — no such date stated |
| the date the survey closes | 2026-07-30 | 2026-07-30 | 0.98 | |
| the date of the design review | 2026-08-06 | 2026-08-06 | 0.87 |
Five auto-accept, one to a person. The interesting row is the fourth: the form contains a date, just not that one. mode came back none, the date came back empty — and it was flagged even though its 0.66 cleared the 0.60 gate, because a date the document never states always goes to review.
That last property matters more than the accuracy numbers. An extractor that returns nothing when the document says nothing is worth more than one that returns a plausible date you then have to audit.
Shape 3 — verify with Jev, escalate to a reasoning model
The SDE cascade cookbook is the pattern for the case where extraction is done by a cheap generative model. Big reasoning models produce correct structured data slowly and expensively; small models are cheap and make mistakes. A cascade runs the cheap model first and pays for the strong one only when a check fires.
In the published version the rungs are gpt-6-luna at rung 0, gpt-6.1-sol with reasoning_effort="high" at rung 1, and jev-1.14.0 as the verifier. The verifier never sees a correct answer — it sees the task and the cheap model’s record — and it answers one Noul per rule the answer must follow, each framed so that true means the rule is broken:
| Rule | Question it asks |
|---|---|
busy_conflict | Does the meeting time overlap a time when any participant is busy? |
outside_hours | Is the meeting time outside the allowed work hours or days? |
breaks_preference | Does it break a stated preference, such as a participant who would rather not meet on a certain day? |
not_earliest | Does the task ask for the earliest availability, and is an earlier valid time available? |
wrong_length | Is the meeting a different length from the one asked for? |
no_single_time | Does the answer fail to propose exactly one day with a start and end time? |
Why the schema check is not enough
The sample task’s cheap answer is {"day":"Monday","start_time":"10:30","end_time":"11:30"}. It is schema-valid — and wrong: Monday 10:30–11:30 overlaps Joan’s meeting at 11:00 and Shirley’s at 11:00. A JSON-Schema validator cannot see that, which is exactly the class of error the cookbook is built to catch.
The recorded Noul answers for that answer:
| Rule | P(broken) | |
|---|---|---|
busy_conflict | 0.97 | <== FIRES |
not_earliest | 0.25 | |
wrong_length | 0.17 | |
breaks_preference | 0.09 | |
no_single_time | 0.07 | |
outside_hours | 0.04 |
One rule fires and the rest stay quiet — which is what makes a single threshold of 0.7 usable. Two design notes from the cookbook are worth repeating: the escalation test is a max, not a mean, so one confident red flag is enough instead of being averaged into silence; and the decomposition into six narrow questions is what a flag can name, where a single “is this answer right?” score cannot say what went wrong.
The escalation did its job — the reasoning model proposed Monday 14:00–15:00, free for all three people.
The cascade on 1,000 tasks
One example shows the loop; the published run shows whether it pays. 1,000 calendar-scheduling tasks from NATURAL PLAN, an answer graded as working if it is schema-valid and proposes one of the task’s valid times, numbers recorded from jev-1.14.0 on 2026-11-05:
| Setup | Mean $ per 1,000 tasks | Share of answers that work |
|---|---|---|
gpt-6-luna alone | 0.156 | 92.6% |
gpt-6.1-sol-high alone | 1.890 | 98.1% |
| Cascade, threshold 0.58 (2.7% escalated) | 0.261 | 94.9% |
| Cascade, threshold 0.29 (13.3% escalated) | 0.490 | 96.5% |
| Cascade, threshold 0.18 (53.6% escalated) | 1.307 | 98.1% |
| Cascade, threshold 0.16 (64.1% escalated) | 1.500 | 98.3% |
Two numbers explain why the cascade has room to work at all: the cheap model was wrong on 74 of the 1,000 tasks, and 72 of those wrong answers passed the schema check. Only semantic rule questions could catch them. Jev’s checks cost $0.04 per 1,000 tasks — about a fortieth of the difference between the two rungs. Past roughly 64% escalation, spending more buys nothing.
The arithmetic before you ship
Jev is priced per input token at $42 per Btok, or $0.042 per Mtok, with output tokens free (Models). Working from the cascade’s published check cost:
- Derived: $0.04 per 1,000 checks ÷ 1,000 = $0.00004 per check; at $0.042/Mtok that implies roughly 950 input tokens per verification request on average — six Noul questions plus the task and the candidate answer. The cookbook publishes the cost, not the token count, so treat 950 as my arithmetic on their figure.
- At the same rate, 1,000 verification requests cost $0.04; 100,000 cost $3.99. Verification is not where a cascade’s budget goes.
- A span-picking request is smaller still — one document plus a handful of short options — so at $0.042/Mtok a call costing $0.000016 moves about 380 tokens. (Derived.) The default per-request context is 64k and the per-question context 32k; the
TypeSafe-Danger-Zone-Long-Context: trueheader raises both to 262k, and the docs are explicit that long context is slower and less accurate, so it is for the requests that need it.
The general lesson from the cost and latency guide applies unchanged: the document usually dominates the bill, which is why one request carrying many questions beats many requests carrying one.
Choosing between the three
- The value exists verbatim in the document, and you can find candidates programmatically → pre-parsed picking. Regex or roster for recall,
Choiceover the spans, code owns the string. This is the safest shape and the one to prefer. - The value must be derived from parts the text states → read the parts, compute in code. Dates, durations, normalised identifiers: anything where a deterministic library should own the arithmetic.
- A generative model is already producing the record → verify and escalate. One Noul per rule, a max over the probabilities, one threshold, and the strong rung only when a rule fires.
- None of the candidates fits → make sure your request can say so. Either the explicit
noneoption, or the companion Noul from the request patterns guide asking whether anything fits at all. TypeSafe’s own caveat is that anone of the aboveoption may not work well in many cases, and a companion Noul is the stronger alternative. - The question has several parts → structure it.
instructions,Choicecriteria values,Scorelevel descriptions andNoulcriteria all accept JSON objects and arrays, which is how a field schema or a database row gets passed in with labelled keys instead of being serialised into a string template.
All three shapes keep the same discipline the confidence and fallback guide argues for: the model answers, the code decides, and every threshold is a named constant in one reviewable file. Extraction is where that discipline pays most visibly, because the failure mode of getting it wrong — a value that was never in the document — is the one users notice.
FAQ
Can Jev extract values that are not already in the document?
No, and that is the point of the documented recipes. In pre-parsed extraction the regex finds every span that could be the value and those spans become the Choice options, so the answer is a verbatim copy of text that was already there. The model chooses which span plays the role; your code owns the string. When nothing fits, the model answers with the explicit none option rather than manufacturing a value.
Why ask for the parts of a date instead of the date? Because the calendar math is deterministic and the reading is not. Seven Choice questions capture what the text says; Python resolves it. The code fills in an unstated year, decides what “next Thursday” means by a stated convention, and rejects impossible readings such as February 30. Jev never does arithmetic.
How many options can one Choice question take? 255. Beyond that, narrow in two stages — pick the section first, then the span inside it. And remember that candidate finding is the real work: emails, phone numbers and amounts have regexes; names do not, so they need a roster or a named-entity recogniser.
Should the cheap rung use structured outputs? The cascade cookbook deliberately does not. Structured outputs force valid JSON and hide the rare answer that breaks the schema; the cookbook asks for a JSON object in the prompt, parses the reply as-is with no regex fishing, and escalates on any failure — escalating being the safe direction. In the published run 72 of 74 wrong cheap answers were schema-valid anyway, so rule checks were doing the actual work.
What does a cascade cost compared with always calling the strong model? $0.261 per 1,000 tasks to reach 94.9% versus $1.890 to reach 98.1%; $1.307 to match 98.1%. Jev’s checks are $0.04 per 1,000 tasks. The cascade pays when the cheap model is right most of the time and its mistakes break rules a check can see.
Does this work on Jev 1.13?
Yes. Every primitive used here — Choice, Score, Noul — exists on both 1.13 and 1.14. Only Box questions require 1.14. The published cookbooks pin jev-1.14.0, which is the model ID for the release shipped on October 14, 2026, so reproduce the numbers on that model if you want them to match.