In purchasing, a confident wrong price is worse than no price at all. So the language model in this product is not allowed to write a single number.
Supplier Intelligence is a B2B tool for comparing supplier offers. The first market is Czech wholesalers of electrical installation material, where a buyer receives quotes and price lists as PDFs, spreadsheets and CSV exports, each with its own units, layout and quirks. The product turns those documents into comparable, verifiable data.
The comparison workspace
The public demo runs on fictional suppliers and offers. A deterministic engine compares offers line by line, rule-based insights point out what deserves attention, and results export to CSV. Two rules run through everything: an unknown value is always empty, never zero, and the best price only counts verified matches from valid offers.
From document to data
Uploading a real document starts a pipeline. The web app validates the file by its content, not its claimed type, stores the original privately and queues a job. A separate worker process then takes it through four stages:
- Parse
- Extract
- Validate
- Persist
Parsing turns PDF, XLSX and CSV files into one shared format of rows and cells, where every cell keeps its location: page, line and bounding box for PDFs, sheet and row for spreadsheets. For PDFs, I group text runs into lines by baseline and split them into cells at column gaps.
The model cites, code reads
For extraction, the model sees the parsed rows with cell IDs and answers with a cell ID, or nothing, for each purchasing field. It never writes the value itself. Code then reads the cited cell and parses numbers, units and dates deterministically. A citation to a cell that does not exist is dropped and flagged.
This also made extraction faster: on the CSV test file, it dropped from 150 to 79 seconds with a local model compared with having the model copy the text back.
- No arithmetic in the model. Money is parsed into exact decimals and calculated with scaled integers. Per-unit prices are derived by code, and the formula is stored with the value.
- Fact, derivation and inference stay apart. Each value is marked as extracted from the document, derived by calculation, or inferred from document-wide context such as “prices excl. VAT”.
- Ambiguity becomes a review item. An unknown unit, a number like
1.150that could mean two things, or a price “on request” is never turned into a value. The document goes to needs review.
Boring, reliable infrastructure
The job queue runs on PostgreSQL, which the app already needed, instead of adding Redis. A partial unique index allows one active job per document version, results commit in the same transaction that completes the job, and stale locks from crashed workers are reclaimed. Every write checks the job attempt, so a resumed stale worker cannot overwrite a newer one. Reprocessing creates a new run and keeps the old ones, so a later failure never hides the last good result.
Documents stay private: originals are served only after a workspace check, logs contain IDs and timings but never document text, and with a local model nothing leaves the machine. The model provider is swappable between a local Ollama model and Claude; so far only the local path is verified end to end.
Evaluation
An evaluation harness runs the real pipeline over a test corpus and compares it with expected results written by hand from the source data, never from model output. The corpus includes a two-page Czech PDF with prices per 100 m, a spreadsheet with a hidden sheet and an unknown unit, a Windows-1250 CSV with an ambiguous number, a scanned PDF and a fake PDF.
| Check | Passed |
|---|---|
| Expected parsing outcomes | 5 / 5 |
| Line-item recall and precision | 23 / 23 |
| Unit prices and price basis | 23 / 23 |
| Source location | 23 / 23 |
| Missing or unknown handling | 43 / 43 |
The honest limits: the local model takes minutes per document, slower than the two-minute target; there is no OCR for scans yet; and complex PDF layouts need a better table parser. Product matching across suppliers and a correction workflow for reviewers are the next milestones.
What I learned
- Let language models do what they are good at, finding things, and let code do what it is good at, exact values.
- Provenance is a feature. Buyers trust a number they can click back to.
- An evaluation set written by hand, with its limits stated, is worth more than a demo that looks right.