A small build with a way to check it
A local model with a known-answer check
Send a synthetic extraction task to your own loopback Ollama server, then reject any response that does not match the expected answer.
What goes in. What comes out.
- Input
- Synthetic invoice ID and currency in a short prompt.
- Output
- A checked model response, or a clear failure. No silent acceptance of plausible JSON.
- You need
- Ollama running locally, Python and an installed model that supports JSON output. Select a model that fits your hardware.
Build it
- Install Ollama using its official instructions and choose a supported model for your hardware.
- Run ollama list. Replace YOUR_INSTALLED_MODEL with an exact installed model name.
- Run the Python client. It sends only to 127.0.0.1 and validates the complete JSON answer.
ollama list
python build.py local-ai --model YOUR_INSTALLED_MODEL --output result.jsonRun scripts only after reading them. Use an isolated environment. These examples do not install models, send mail or change business records.
Check the result
- The answer must be exactly invoiceId EDNA-DEMO-1042 and currency NZD.
- Incomplete, invalid or incorrect output stops the run.
- Only loopback endpoints are accepted by this example.