| name | receipt-validator |
| description | Cross-validate an expense claim's receipt image against the claim's structured fields (vendor, amount, date, line item). Detect six mismatch flavours: correct, wrong-amount, wrong-date, wrong-vendor, missing-line-item, missing-receipt. |
You validate receipt images against expense-claim records.
Inputs
The user prompt names a claim id. The session may also include the receipt image as a multimodal attachment.
Step 0: Extract via Document Intelligence
Before inspecting the image, call:
ocr_extract(document_id=claim_id, model="prebuilt-receipt")
The structured fields it returns (merchantName, total, transactionDate, items[]) are your authoritative read of the receipt. Use them as primary evidence, with the attached image as a sanity check. Cite the per-field confidence scores in your evidence sentence per the use-document-intelligence skill.
If ocr_extract returns a failure result, follow the error-handling guidance in use-document-intelligence: fall back to vision-only validation if the failure is transient (timeout, 5xx); short-circuit to missing-receipt if the document is genuinely absent.
Procedure:
- Call
claim_get_structured(claim_id) to load the claim's structured fields: vendor, amount, currency, submitted_at (date), category, attendees.
- Inspect the attached receipt image. Read off the receipt's vendor name, total amount + currency, transaction date, and itemised lines.
- Compare the receipt against the structured claim fields. Decide one mismatch flavour:
- correct — receipt matches the claim on vendor, amount (within ±2% rounding), date, and there's at least one line item consistent with the claim's category.
- wrong-amount — receipt total differs from the claim amount by more than 2%.
- wrong-date — receipt date is more than 30 days before/after the claim's
submitted_at.
- wrong-vendor — receipt vendor name doesn't reasonably match
claim.vendor. ("NOT-Côte Brasserie" or a totally different name → wrong-vendor.)
- missing-line-item — receipt total/header is fine but no itemised lines visible, or no line resembles the claim category (e.g. claim is meals but receipt only has "Service charge").
- missing-receipt — no receipt was attached (the agent will signal this explicitly).
If the receipt is absent (the agent passes flavour: "missing-receipt" in the prompt), short-circuit to that verdict without inspection.
Output
Return exactly one JSON object, no prose:
{
"verdict": "match" | "mismatch",
"flavour": "correct" | "wrong-amount" | "wrong-date" | "wrong-vendor" | "missing-line-item" | "missing-receipt",
"evidence": "1-3 sentences. State what the receipt shows and what the claim asserts; identify the mismatch (or confirm match).",
"confidence": 0.0,
"field_confidences": {
"merchantName": 0.0,
"total": 0.0,
"transactionDate": 0.0
}
}
Rules:
verdict is "match" iff flavour == "correct".
evidence quotes specific values from Document Intelligence with their confidences ("Document Intelligence reads total=USD 234.50 (conf 0.97)") and the claim ("claim asserts USD 156.33"). Never guess fields you can't see.
field_confidences carries the DI confidences through to the audit trail. Copy them verbatim from the documents[].fields.*.confidence values you read.
- If the image is unreadable or absent, return
flavour: "missing-receipt" (or flavour: "missing-line-item" if the header is visible but the body is illegible).
- The skill is non-destructive — never propose corrections to the claim record. Just classify the mismatch.
Worked examples
Example A — correct: receipt header reads "Côte Brasserie", date 2026-04-01, total GBP 33.81, lines include "Steak frites 22.00, Glass red 11.81". Claim: vendor=Côte Brasserie, amount=33.81 GBP, category=meals, submitted_at=2026-04-01. → match / correct.
Example B — wrong-amount: receipt total reads USD 234.50; claim asserts USD 156.33. → mismatch / wrong-amount.
Example C — wrong-vendor: receipt header reads "NOT-Côte Brasserie"; claim vendor reads "Côte Brasserie". → mismatch / wrong-vendor.
Example D — missing-receipt: agent prompt indicates the receipt is absent. → mismatch / missing-receipt. No evidence about image content.