Docs
OfficialJev Cookbooks
Cookbook: SDE Cascade
A two-stage extraction cascade: a mini model extracts, a Noul battery verifies each field in one request, and a 0.7 gate escalates to a reasoning model, sitting on the cost/quality frontier.
- Format
- Docs
- Reading time
- 3 min
- Published by
- TypeSafe AI
- Last verified
- Sep 2026
Highlights
- Pipeline: gpt-5.4-mini extracts, one Noul battery verifies fields in a single call, and a 0.7 gate escalates to gpt-5.5.
- A fabricated description read hallucinated 0.95 and off_target 0.85 while correct and empty fields read 0.02 to 0.14.
- On an internal 100-prompt sweep the cascade sat up-and-left of every single model on the cost/quality chart.
- A jsonschema-valid but semantically wrong record shows validation alone cannot catch extraction errors.
Quickstart
python
mini_record = extract(MINI, prompt, schema, content, temperature=0)
answers = ts.system_one(
state={"source_text": content, "schema": schema, "extraction": mini_record},
questions=build_questions(mini_record), # per-field Noul battery, P(wrong)
model=TS_MODEL,
).answers
fired = {qid: a.noul for qid, a in answers.items()
if not qid.startswith("__overall__") and a.noul > FIRE_T} # FIRE_T = 0.7
if fired: # any field flag fires -> escalate to the reasoning rung
final = extract(REASONING, prompt, schema, content, reasoning_effort="high")Watch out
The cost/quality sweep is a historical snapshot not recalculated at the current Jev rate, so re-run it before quoting the numbers.
Questions about this entry
Short answers drawn from the linked project or page.
Any per-field Noul above 0.7 escalates the record to the reasoning model. The fabricated-description case read hallucinated 0.95 and off_target 0.85, while correct and empty fields sat between 0.02 and 0.14.
No. The cookbook includes a jsonschema-valid but semantically wrong record, showing validation cannot catch extraction errors; the Noul battery is what flags them for escalation.
Rung 0 is gpt-5.4-mini at $0.75 input and $4.50 output per million, rung 1 is gpt-5.5 at $5.00 and $30.00, roughly seven times the mini, and the verifier is jev-1.12 at $0.042 input with output tokens free. Standard rates were checked on 15 September 2026, and the reasoning rung runs with reasoning_effort set to high.
The cookbook deliberately avoids structured outputs, tool calls and JSON mode. A schema-following mistake is not the mistake it expects an LLM to make, since synthetic examples are easy to make, and when a model does fail the schema it is almost always because it is confused, which constrained decoding does not fix. It still encourages you to try them.
One yes/no Noul per extracted field, all in a single call against a state holding the source text, the schema and the extraction. Each asks something like whether a value is absent from the source or was lifted from unrelated text, and each returns P(something is wrong). Questions whose id starts with the overall prefix are excluded from the gate.
A pinned Hugging Face dataset, scrapegraphai/scrapegraphai-100k at a fixed revision, split train, row 516. The example asks for New York University's fall registration open date for the 2024-2025 school year against NYU's scraped homepage, with a two-field schema covering the date in mm/dd/yyyy and a short description.
pip install openai datasets jsonschema ipython 'cooksafe>=0.2.0,<0.3.0', then set OPENAI_API_KEY and TYPESAFE_API_KEY. On an internal 100-prompt sweep the cascade sat up and to the left of every single model on the cost/quality chart, but the caveat is explicit that the sweep is a historical snapshot not recalculated at the current Jev rate, so re-run it before quoting the numbers.
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
X: A 26-sheet plan set in 2.9 seconds
X: Which exam questions come back
X: 100,000 viral posts in 20.4 seconds
X: 900 images in 40 seconds
From the Jev guides
Original write-ups on what this entry is for.
From the Jev AI model community
Posts from builders shipping with Jev right now.