Every digit has been recognised. Even so, the subtotal ends up in the data record as the final amount. Errors like this look tidy: valid JSON, filled-in fields, no red error message. What is missing lies in the relationship between number, label and table row.
Mistral’s OCR documentation describes, among other things, structured text, table formats and block coordinates. Document Annotations can additionally convert information into a predefined JSON format. These building blocks solve different parts of the route from document to application.
Four levels for a single field
First, the characters have to be read. Then the application needs their position and order. After that, it has to recognise which field a value describes. Finally, factual relationships come in: does the final amount match the line items given in the example and the stated discount?
An error at any of these levels can end up producing the same wrong number. That is why complete text output alone is not a sufficient quality measure. For an important value, the way back to where it was found should be preserved.
This does not always have to be an elaborate graphical marker. A document identifier, the page and an unambiguous field description already help. If coordinates are used, they must belong to the right page and rendering. A rectangle without a clearly identified document version can itself cause confusion later.
Create an invoice whose content you know
For a manageable test, you design your own PDF with two line items. Item A contains two units at ten euros each, item B one unit at fifteen euros. Below them are a discount of five euros and a final amount of thirty euros. An order number is deliberately missing. The figures serve only as a technical explanation, not as a template for tax purposes.
Before extraction, note the expected values and where they are located. In a second version, change only the layout: discount and total now sit closer to the line items. That way, you can later tell whether the assignment uses the label or relies on a coincidental position.
Let a suitable external OCR route deliver text and structure first. A downstream extraction should output the final amount, currency, order number and location in the document. The missing order number is kept as unknown. An invented substitute number would be an error, even if it fills the output format completely.
A small factual check outside the model
The simple arithmetic relationship of the synthetic example can be checked independently. For decimal amounts like these, use Decimal, for example, rather than binary floating-point values. This Python example, written by us, checks only the teaching calculation we defined:
from decimal import Decimal
positionen = [
(Decimal("2"), Decimal("10.00")),
(Decimal("1"), Decimal("15.00")),
]
rabatt = Decimal("5.00")
ausgewiesen = Decimal("30.00")
berechnet = sum((menge * preis for menge, preis in positionen), Decimal("0")) - rabatt
assert berechnet == ausgewiesen
A passed arithmetic check would only show that the numbers used here fit together. It does not prove that the OCR took these numbers from the right document. That is why the arithmetic check and the source check remain two different steps.
In a real application, you also have to observe the rules of the specific document type. Taxes, rounding, currencies and special cases cannot be derived from this simplified invoice. The task here is merely to transfer a known assignment in a traceable way.
Uncertainty belongs in the hand-over contract
Define explicitly what happens with an illegible digit or a contradiction. A data record can contain the value, where it was found and a clarification status. Only a confirmed transfer then triggers the intended next step.
A suitable instruction: “Do not add missing information. For every amount you transfer, refer to the labelled field. Record contradictory totals separately. Produce only a preview, not an accounting entry.”
The concrete test thus goes beyond simply reading out the PDF. You check characters, structure, field meaning and a known relationship separately. This is exactly what creates a usable route to data that does not just look tidy but also leads back to the original.
Sources and status
Sources as of 25 October 2026. Document AI OCR processor · Document Annotations.

