LyraLearn AI Learning Platform
Exams
← Module 13 Β· Monitoring and Observability
🎧 Listen

The AI Evaluation Record

Logs scroll away and traces expire. To actually study your AI over weeks and months, you need a durable, queryable record β€” one row per AI call. In LyraLearn that record is the ops.AiEvaluations table, and it is the backbone of everything in this module.

Every AI model call writes exactly one durable row into an evaluation table, with a trace thread linking the row back to logs and traces.

One row per call

Every time a feature invokes the model, it writes a single row capturing what happened. The columns are chosen so that later you can slice quality, cost, and performance without going back to raw logs:

Why each field earns its place

Nothing here is decorative. EvidenceStrength and Refused are the quality signals β€” together they tell you whether the RAG pipeline is finding good sources or quietly degrading. PromptHash lets you A/B a prompt change: filter to the old hash and the new one, compare refusal and latency. Tokens drive the spend dashboards. Provider/Model let you compare a cheap local model against a cloud one on the same questions. And TraceId is the thread that stitches the durable record back to the live telemetry β€” when one row looks wrong, you can pull the full trace and read exactly what was retrieved and sent.

Write it at the call site, fail closed

The record is populated in the same code path that makes the call, inside the same unit of work, so it can never drift out of sync with reality. Crucially, a refusal still writes a row β€” refusals are data, not silence. If the model call itself throws, the surrounding handler still records the attempt with the error captured.

This is the practical embodiment of "measure everything": a real .NET table you can query with plain SQL, feeding the metrics and regression tests in the lessons that follow.

🧠 Quiz yourself on this lesson →

Ask the AI Tutor

Grounded in the course lessons β€” it cites its sources and says when it doesn't know.