Get Started

Turn invoices, receipts and forms into clean JSON with a local AI

A folder of PDFs and phone photos goes in; validated JSON and a spreadsheet come out, with every document that doesn't add up flagged for a human. Ollama's schema-constrained output makes the model fill in your exact fields, Pydantic and a few lines of business rules catch what it gets wrong, and a scorer tells you how accurate it really is. Nothing leaves your PC.

110 minIntermediateTools: FreeStep 1 free
A batch extractor for PDFs and imagesschema-constrained output, validation, business-rule checks and an automatic retry
Schemas for invoices with line items, receipts and a registration form, ready to copy for your own documents
An accuracy scorer that compares every field with the right answer and lists each mistake
  • Spreadsheet export with a needs_review column, so a person checks only the documents that need it
  • Real numbers from a laptop CPU: 205 of 205 fields right on clean documents, and how the checks behave on rough scans
Before you start
01/08Why a local model, and why schemas0 done
STEP 01 of 08~10 min

Why a local model, and why schemas

Three layers make extraction trustworthy: a schema the model must follow, validation, and rules the model can't fake.

  1. The jobsupplier, invoice number, dates, every line item and the totals from a pile of invoices; merchant, items and total from receipt photos; the answers from filled-in forms. People pay for this by the hour, and accounts software charges per document. A 4B model on your own PC does it free, and client paperwork never goes near a cloud service.

  2. Layer 1: schema-constrained outputOllama's format parameter accepts a JSON schema, and the model's output is constrained to match it: right field names, right types, no chatty preamble. You write the schema once as a Pydantic class and send Model.model_json_schema().

  3. Layer 2: validationThe reply is parsed with Model.model_validate_json(). Dates must be real dates, money must be numbers, a payment method must be one of the allowed values. Anything else is an error your code sees.

  4. Layer 3: business rulesValid JSON can still be wrong. Line items must add up to the subtotal, subtotal plus VAT must equal the total, the date must be plausible. When a rule fails, the script retries once with the problems spelled out, and if it still fails, it flags the document for a human.

  5. Get the kitdoc-extract.zip has the scripts and 12 sample documents for fictional businesses with their right answers. kit.md has the schema-writing rules and a step-by-step order for your own documents.

✓
CheckpointYou can say what each of the three layers catches that the others don't.
Stuck? Ask the community
Next mission · Own your AITalk to your AI out loud, in real time, fully offline
→