fix: tighten receipt amount extraction prompt to reduce OCR misreads

Replaced 'pick the largest one' guidance with 'bottom-most total' and
'return 0 if no clear total found' to avoid picking line items or tips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-16 16:47:48 -04:00
parent bb1e93fabb
commit 774c0cc062

View File

@@ -327,9 +327,10 @@ class ExpensesAgent(BaseAgent):
'Return ONLY valid JSON with these keys:\n'
'"vendor" (string, merchant or restaurant name),\n'
'"amount" (number — the FINAL total the customer paid; '
'this is labeled "Total", "Amount Due", "Grand Total", or the last dollar figure; '
'do NOT use subtotal, tax, or tip separately; '
'if multiple totals appear pick the largest one labeled as the final total),\n'
'look for a line explicitly labeled "Total", "Grand Total", "Amount Due", or "Balance Due"; '
'do NOT use subtotal, tax, tip, or individual line items; '
'if the label is ambiguous choose the bottom-most total on the receipt; '
'return 0 if no clear total is found),\n'
f'"date" (string YYYY-MM-DD, use {date_hint or today} if not found in text),\n'
'"time" (string HH:MM in 24-hour format — the transaction time printed on the receipt; '
'null if not present),\n'