Extract, then verify
Extract returns a filled object and nothing else. The response carries no probability, so a wrong value looks exactly like a right one.
Verify closes that gap. It re-reads the source text for one field, compares your value against what it finds, and returns the spans it read. Run it before you write an extracted value into a database, a ledger, or a payment.
The loop
Extract the record
Send your JSON Schema to /v1/decision-machine-1/extract. You get a typed object back. Missing values are null.
Verify does not correct a value. It reports agreement or disagreement. Your code decides what happens next.
Step 1: extract
This invoice text drives the whole page.
A four-field schema returns this:
Two of these fields move money: invoice_number and total_due. Verify both.
Step 2: verify
Step 3: read the answer
Real responses against the invoice text above:
Three fields carry the decision.
matchesistruewhenprobability >= 0.5.probabilityis the confidence of the span that matched. It is0when no span matches.foundlists every span verify read for that field, match or not.
A correct value can still score low. The right invoice number scored 0.638 above.
found is the field that makes a review queue useful. A human sees ["4471"] next to your value 4417 and fixes the record in seconds.
The matching rule
Verify compares canonical forms, and containment counts only from 3 characters up, so short values need exact text. Verify states the full rule.
Routing bands
Set one threshold per field, not one per document. Raise the bar with the blast radius.
Start at 0.9 for payment amounts and account numbers. Start at 0.7 for references, dates and counterparties. These two numbers are a starting point, not a measured result. The helper above uses one threshold of 0.7; raise it per field for the values that move money.
The thresholds page explains how to pick these numbers from your own data.
Verify only checks fields you ask about. One verify call covers one field. List every field that carries risk, and check each one.
Latency cost
A verify call takes about 0.5 s. An extract call over a short document takes about 0.7 s. Three verify calls in sequence add about 1.5 s. Run them concurrently to keep the wait near one call.
Both calls read the same text. Cost scales with the length of the text plus the schema and the field you send, at $0.04 per million input tokens and $0 per output token. See Pricing. Send the smallest span that contains the field. A 2,000-character page beats a 20,000-character bundle.
Next
- Verify — the full request and response shape.
- Invoice extraction with verification — the same loop over an invoice header schema.
- Confidence routing — the act, confirm, review and escalate bands.