Overview
Branch creates a zero-copy fork of a document. Ingest withmode: "replace" supersedes
existing nodes on affected pages. Together they let you correct extraction errors in
isolation and compare results.
The problem
OCR textlayers sometimes get numbers wrong — dropped signs, lost precision. A completion grounded in bad extraction data gives wrong answers. You need a way to fix the data without mutating the original document.Flow
Full example
How mode: "replace" works
| Mode | Behavior |
|---|---|
append (default) | New nodes are added alongside existing ones |
replace | Existing nodes on affected pages get status = 'superseded', then new nodes are hydrated. Completions only read non-superseded nodes. |
vendor_log.
Branch response
When to use this
- Eval corrections: fix extraction errors on specific pages to measure impact on downstream completions
- A/B testing vendors: branch, re-ingest with a different vendor’s output, compare answers
- Human-in-the-loop: reviewer corrects a table, ingests the fix on a branch, promotes if better
- Safe experimentation: try schema changes or re-extraction without risking production data
Live demo
See the interactive version at ingest-branch-demo.pages.dev.Related
Ingest API
Push pre-parsed vendor output into OkraPDF.
Structured Extraction
Extract typed data from documents with Zod schemas.