AWS Builder Center

The invoice bot said $42. The invoice said $24.

A three-file AWS demo for testing whether an AI assistant can tell a corrected invoice from an old one, cite its evidence, and handle a missing revision.

Your AI demo answers an invoice question in two seconds. The answer has a citation, the interface looks polished, and everyone moves on. Then someone opens the invoice. The bot said $42. The amount due was $24.
That is the bug I would put in an AWS demo on purpose. It teaches a lesson that a happy-path walkthrough can hide: a citation can point to a real file and still support the wrong answer.

Build the smallest possible trap

Make three synthetic text files and upload them to a test bucket in Amazon S3. Use fake data so you can share the fixtures and the results.
File
What it says
 invoice-v1.txt 
Invoice INV-104, issued October 1, amount due $42
 invoice-v2.txt 
Invoice INV-104, issued October 3, corrected amount due $24, supersedes v1
 shipping-note.txt 
Order 104, shipping completed October 4, shipping charge $8
Start with a simple harness that hands the model a fixed set of excerpts. You can use Amazon Bedrock for generation and add a retriever once the test behaves as expected. Ask: What is the current amount due on invoice INV-104?

Run the same question four ways

  1. Both versions. Expect $24 and a citation to v2. Reverse the input order and run it again. The answer should follow revision metadata in either order.
  1. Shipping note only. Expect an explanation that the amount due could not be verified from the retrieved documents.
  1. Old invoice only. If the system has no way to establish that v1 is current, expect it to report the dated amount as historical and withhold a definitive current balance.
  1. Missing correction. Give the model v1 plus a revision manifest that says v2 is current. Expect it to flag missing evidence. The manifest can establish the current revision, but the amount must come from the invoice.

Make the failure easy to diagnose

Keep a small trace for each run: the expected document revision, the IDs and revisions retrieved, the amount returned, and the cited excerpt. Use the synthetic fixtures for traces you plan to share.
If v2 never reaches the model, look at retrieval and version filtering. If v2 is present and the answer still says $42, look at how you present precedence to the model and how you check the output. If the amount is right and the citation is wrong, count that as its own failure. A useful test checks both the answer and the evidence.
For this fixture, I'd have the application resolve the current revision before it calls the model. Then I'd require the returned citation to match that revision and verify that the cited excerpt contains the extracted amount. When the revision is missing, the app can give a specific response: “I found an older invoice, but couldn't verify the current amount due.” That gives the reader a reason to check the source.

The test I'd put on stage

Show the correct answer once. Then remove the corrected invoice from the retrieval results and rerun the exact same question. If the app can explain what went missing, the audience gets to see how it behaves when the data stops cooperating.
Your turn: Which document would you sneak into this demo to break it next: a credit note, a duplicate invoice ID from another vendor, or a scanned PDF with an OCR typo? What would you expect the app to say?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article