Every accounting department and operations lead knows the pain of 'Vendor Invoice Chaos'.
Vendor A sends an invoice as an email paragraph. Vendor B sends an unformatted plain text receipt. Vendor C lists 12 line items, but buries a 5% discount code in sentence 4 and adds an unexpected $45 freight shipping charge at the very bottom.
The Arithmetic Reconciliation Check
The biggest trap when using AI for invoice extraction is that models might extract line items accurately, but hallucinate the sum.
Extract all line items from <invoice> into a Markdown table with columns:
[Item Description, Quantity, Unit Cost, Total Cost]
Rules:
• Show your math step by step inside a <verification> block.
• Append a final Reconciliation Row: Subtotal + Shipping + Tax = Grand Total.
• If the numbers don't match the stated invoice total, flag: [DISCREPANCY DETECTED].
Handling Currency Symbols & Conversions
Always standardize currencies into a single column (e.g. currency: 'INR' or 'USD') and store amounts as plain numeric floats (1499.00) so they can be piped directly into accounting software.