Testing LLM tool calls against the database, not the transcript
For a model that changes data, the transcript is the wrong thing to grade. Snapshot the database before and after the run, and assert on the difference.
On the LLM Evaluator project at Devsarch (client: Turing) I maintained evaluation pipelines for models that call tools. The core idea fits in one sentence: model output is judged against database state, not against a transcript.
Why not grade the transcript
When a model can call tools that write to a database, what it says and what it does can drift apart. A response can read perfectly while the tool call underneath wrote the wrong row, or wrote two. Grading the text rewards the description of the work, not the work.
The shape of the harness
- Snapshot the relevant database state before the run.
- Run the model with its tool calls, exercising the full code path.
- Snapshot the state again after the run.
- Diff the two snapshots and assert on the difference.
It is built with FastAPI, PostgreSQL and Pytest, so every evaluation is an ordinary test.
Assert both directions
The diff answers two questions, and both matter:
- Did the run change what it should have?
- Did it change anything it should not have?
The second is easy to skip, and it is where the expensive bugs hide: an extra update, a record touched outside the scope of the request. A diff makes unintended writes visible by default instead of something you have to remember to check.
A regression gate
Put together, the suite becomes a gate: a model change ships only if every assertion still holds. Model and prompt changes then go through the same check as any other change to the code.