Convert a photo into a validated domain object.
1. Image preparation
Decode orientation correctly and resize within task requirements. Avoid sending unnecessary surrounding content. Bound input dimensions and handle unreadable or unsupported images before inference.
2. Response schema
Specify merchant, currency, line items and totals with an explicit unknown state. A model may misread digits; reconcile totals and reject unsupported currencies before using the result.
3. User correction
Show extracted fields as editable suggestions. Preserve the original image only under a stated retention policy and allow the user to retry or enter data manually.
Worked scenario
A blurred receipt produces a plausible merchant and an incorrect total. The UI highlights the extracted total for confirmation instead of recording it as authoritative.
Apply it
Build a receipt parser with a typed output validator and a correction screen. Test a rotated photo and a non-receipt image.
Check your understanding
A schema-valid but numerically inconsistent receipt is flagged for correction. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.