The problem
Receipt photos become expense lines: merchant, date, tax, tip, category. Finance wants the lines to sum to the receipt total before reimbursement. LLM extraction gets the merchant wrong occasionally; it also gets arithmetic wrong more often than vendors admit.
Why Ecko
- Contracts on totals
@ensures "line items sum to the stated receipt total within 0.01"turns a finance rule into an executable gate. Failures retry or route to human review with the trace attached.- Overflow as error
- Integer and decimal operations throw on overflow instead of wrapping. A runaway total stops the batch rather than posting a negative reimbursement.
- CSV and SQL in the box
- Write results to finance's staging table or export a CSV without pulling in pandas or a second runtime.
In practice
type Receipt = { merchant: str, total: decimal, lines: list(Line) }
@ensures "sum of lines equals total within one cent"
fn extract(image_desc: str) -> Receipt {
ai "Extract line items from this receipt" from image_desc
}
Try it on your workload.