nirmala¶
Grounded, verifiable document extraction. PDFs in; typed Pydantic models and an auditable verdict out.
import nirmala
result = nirmala.extract("invoice.pdf", Invoice, gate=nirmala.Gate())
result.data, result.verdict.decision # (Invoice(...), "approve")
nirmala is built on two rules learned from running document extraction in production:
- A model's answer is a claim, not a fact. Every value is snapped to the printed text, normalized and checked before it is accepted.
- Fail closed. If the model is down, unsure or contradicted, the record goes to review. No error path can produce an approval.
Where to go next¶
- Getting started: install, sign in to OpenCode, first extraction.
- Schemas: field options, normalization, nested models.
- Rules & decisions: decorators, plain-English rules, YAML, confidence gates.
- Real-world PDFs: scans, passwords, duplicates, picking the right file.
- Backends: OpenCode, OpenAI-compatible endpoints, your own client.
- Extending nirmala: plug in your passwords, normalizers and events.