How a small Rails bookkeeping app turns a photo or PDF of a receipt into structured expense data, with several small, focused LLM calls using structured output. All prompts and schemas are quoted verbatim. At the end: how the extracted facts become a VAT treatment without the model deciding it, and an end-to-end test to run against your own scans.
It was essential for me that the setup handles cross-border VAT stuff correctly, that the output is sane, that I do not have to check every single value over and over - and that it's reasonably workable from the handwritten service receipts (yes I have these too!) to Stripe invoices for SaaS I have to use.
The app uses RubyLLM 2.x with Claude Haiku 4.5, a 120-second request timeout and three retries with backoff. You can refit this to any language or stack you want - but I like writing Ruby and I have my agents do the same. [There is no reason to write less Ruby, exactly the opposite](h