Ovrin does not treat document extraction as a single prompt. It uses a pipeline.
The nine stages
A document passes through nine named stages, in this order:
- Detect — the format, determined by content rather than by file extension.
- Acquire — page content, as text, images, or both.
- Normalise — one text stream, with offsets preserved back to the source.
- Schema — your Go type read by reflection into a JSON Schema.
- Prompt — the request built in the core, with document content kept as data.
- Generate — the model call, returning raw JSON.
- Validate — field rules and cross-field rules.
- Ground — each value searched for in the document.
- Score — the signals combined into confidence and a review decision.
Each stage names itself in errors and events, so a failure says which one failed.
Why the pipeline matters
This design allows Ovrin to do things a raw prompt cannot do reliably:
- prefer exact text when present
- fall back to OCR only as needed
- detect fabricated values
- validate numbers and enums
- explain where a field came from
- keep confidence decomposed and inspectable
A production mindset
The pipeline is what makes Ovrin a document-processing system rather than a model wrapper. When the extracted number is a payment amount, a missing field, or a contradictory figure, the product needs more than a plausible answer. It needs provenance and validation.