From 774c0cc0623666706d12fa4719e314809365a817 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Sat, 16 May 2026 16:47:48 -0400 Subject: [PATCH] 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 --- agent_service/agents/expenses_agent.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/agent_service/agents/expenses_agent.py b/agent_service/agents/expenses_agent.py index 04c2512..09fb2d0 100644 --- a/agent_service/agents/expenses_agent.py +++ b/agent_service/agents/expenses_agent.py @@ -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'