Structured extraction
Install the matching release in a Python environment:
python -m pip install cayuDownload structured-output.py, then run:
python structured-output.pyThe complete source and explanation sends an invalid first response and a valid repaired response through ScriptedModelProvider. It asserts success, an empty tool-strategy final text, the exact validated output {"invoice_total": 42.5} and repair attempt 2.
This proves runtime schema validation and repair for the fixture. To evaluate a real invoice extractor, replace the scripted provider in your project, use representative synthetic documents, and add assertions for totals, currency and evidence location. A valid schema alone does not prove a correct invoice total.