Repository navigation
Recipe 39: Document extraction cascade #39
Copy link
Copy link
Closed
Labels
cat: data quality & graphsCategory: Data quality & knowledge graphsCategory: Data quality & knowledge graphsdecision: choiceUses a Choice questionUses a Choice questiondecision: combinationComposes more than one decision typeComposes more than one decision typedecision: noulUses a Noul questionUses a Noul questionlevel: 3 intermediateMultiple judgments or stages with deterministic compositionMultiple judgments or stages with deterministic compositionpriority: p2Scheduled after p1 workScheduled after p1 worksize: MAbout a dayAbout a daystatus: in progressClaimed; a branch or pull request existsClaimed; a branch or pull request existstype: recipeA cookbook notebook recipeA cookbook notebook recipe
Milestone
Description
Recipe 39 of 60 · Level 3 (Intermediate) · Data quality & knowledge graphs ·
Choice+Noul
Use case
Select candidate values for document fields, verify each selection against its source span, and route uncertain or inconsistent records to review.
What to build
The folder recipes/39-document-extraction-cascade/ with notebook.ipynb, README.md, and fixtures/, meeting the recipe contract. Start from python tools/new_recipe.py 39 and the template in recipes/_template/.
Build notes
- Stage one: a Choice selects a candidate value for each field.
- Stage two, in a later request: a Noul verifies each selection against its source span.
- Uncertain or inconsistent records go to review.
Decision design
- Choice. Options are a fixed set supplied by Python, including the fallback outcome this use case names. Show the
choice, the per-optionprobabilities, and theconfidencefor individual examples before aggregating. - Noul. Write each proposition as a statement that is true or false. One independent question per label or concern, sent together in one request. Noul has no confidence field, so each threshold is chosen from examples and evaluated.
- Composition. Independent questions share one request. A question that depends on an earlier answer goes in a later request, and the notebook makes that boundary visible.
Level 3 scope
Multiple judgments or stages, structured evidence, deterministic composition, and task-level evaluation.
Acceptance criteria
-
recipes/39-document-extraction-cascade/notebook.ipynbruns top to bottom offline, with no key and no network, and its outputs are committed - Live mode is opt-in (
JEV_COOKBOOK_LIVE=1withTYPESAFE_API_KEY) and uses the same question definitions as the offline run - Fixtures are synthetic, include the hard cases named in the build notes, carry gold labels, and pass the fixture validator
- Every response fixture records its provenance, and the notebook states which mode it ran in
- Evaluation: Field-level accuracy, the review rate, and the error rate among records not sent to review.
- The deterministic composition lives in a Python function with tests in
tests/ - Evaluation is at task level, not only per question
- No statement about Jev's quality, latency, or cost appears without recorded live inference; in a synthetic run, metrics are labelled as pipeline checks
-
recipes/39-document-extraction-cascade/README.mdsays what the recipe teaches, how to run it, and what was and was not measured live - The pull request changes only
recipes/39-document-extraction-cascade/and CI is green
Dependencies
- Blocked by Foundation: CI executes every notebook offline and validates fixtures #69 (CI executes every notebook offline and validates fixtures)
- Builds on Recipe 14: Source span selection #14 (Source span selection). Merge those first and reuse their patterns; do not copy their fixtures.
- Tracked in Epic: Level 3 · Intermediate recipes #77
Sources
Read these before writing the questions.
- S02 · TypeSafe AI: Primitives (Questions): Choice, Noul, Score, independent questions, and dependent follow-up calls.
- S03 · TypeSafe AI: Confidence: Distribution-derived confidence and task-specific thresholds informed by observed outcomes.
- S06 · TypeSafe AI: Cookbooks: Worked patterns for extraction, citation checking, skill selection, hierarchical classification, and feature discovery.
Out of scope
- Changes to shared code, the catalog, or the root README. If the shared package is missing something, open a foundation issue and link it here.
- Real side effects of any kind. Actions are simulated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cat: data quality & graphsCategory: Data quality & knowledge graphsCategory: Data quality & knowledge graphsdecision: choiceUses a Choice questionUses a Choice questiondecision: combinationComposes more than one decision typeComposes more than one decision typedecision: noulUses a Noul questionUses a Noul questionlevel: 3 intermediateMultiple judgments or stages with deterministic compositionMultiple judgments or stages with deterministic compositionpriority: p2Scheduled after p1 workScheduled after p1 worksize: MAbout a dayAbout a daystatus: in progressClaimed; a branch or pull request existsClaimed; a branch or pull request existstype: recipeA cookbook notebook recipeA cookbook notebook recipe
Activity
Recipe 39: Document extraction cascade (#242)