AI Testing Metrics
AI evaluation tools such as Promptfoo, DeepEval, Inspect AI, Ragas and the LM Evaluation Harness measure the quality
of LLM applications and models. Each of them writes its results in its own format, so Testkube needs a common format
to chart them. This page explains what these tools measure, how Testkube ingests and charts their metrics, and how the
testkube-ai-metrics-parser converts the output of each tool
for you.
What AI Evaluation Tools Measure
A traditional functional test either passes or fails. The output of an LLM is not deterministic, and its quality is a matter of degree, so AI evaluation tools report scores alongside pass/fail results. Most of what they produce falls into a few groups:
| Kind of metric | What it tells you | Examples |
|---|---|---|
| Assertion results | How many test cases met their assertions or thresholds, and the resulting pass rate. | Promptfoo successes, failures and pass rate; DeepEval passed and failed test cases |
| LLM-as-a-judge quality scores | A score, usually between 0 and 1, that a second model assigns to an answer for a quality such as relevancy, correctness, or the absence of hallucination. | DeepEval answer relevancy, G-Eval and hallucination metrics |
| RAG metrics | How well a retrieval-augmented generation (RAG) pipeline grounds its answers in the retrieved context, and how relevant that context is. | Ragas faithfulness, answer relevancy, context precision, and context recall |
| Benchmark scores | How a model performs on a standardized dataset of tasks, often with the standard error of the score. | LM Evaluation Harness exact match on gsm8k; Inspect AI accuracy and standard error |
| Cost and efficiency | What a run costs and how long it takes. | Token counts, cost of the judge model calls, evaluation duration |
A single run of an evaluation tells you little on its own. The value comes from following these metrics over time, so you can:
- Catch a regression when a prompt, a retrieval step, or the application code changes.
- Compare models, or model versions, on the same evaluation before you switch.
- Notice drift in a hosted model that changes behind the same name.
- Track the cost and token usage of your evaluations as they grow.
Ingesting AI Metrics in Testkube
Testkube ingests custom metrics from any Workflow step that writes them in InfluxDB line protocol, a simple text format with one record per line. Each record has a measurement name, optional tags and one or more numeric fields:
measurement[,tag_key=tag_value...] field_key=value[,field_key=value...]
For example, a DeepEval run against gpt-4o can be summarized as:
deepeval,metric=answer_relevancy,model=gpt-4o cost=0.019998,errors=0i,failed=0i,mean_score=1,passed=2i,tests=2i
deepeval,model=gpt-4o errors=0i,failed=0i,passed=2i
To get these metrics into Testkube:
- Run the evaluation tool in a Workflow step, so that it writes its results to files in the working directory.
- Convert the results to line protocol and write them to a file with an
.lpor.influxextension. - Upload that file as an artifact. Testkube detects the line protocol during
the upload, registers the file as an
influx.line_protocolreport and ingests its numeric fields after the execution completes.
Testkube turns each field into a metric key, {measurement}_{field} in lower case, and each tag into an identity
field that you can segment and filter by:
| Line protocol record | Metric keys | Identity fields |
|---|---|---|
deepeval,metric=answer_relevancy,model=gpt-4o mean_score=1,tests=2i | deepeval_mean_score, deepeval_tests | metric=answer_relevancy, model=gpt-4o |
ragas_eval,model=gpt-4o-mini answer_relevancy=1,faithfulness=1 | ragas_eval_answer_relevancy, ragas_eval_faithfulness | model=gpt-4o-mini |
promptfoo_eval pass_rate=1,total_tokens=125i | promptfoo_eval_pass_rate, promptfoo_eval_total_tokens | none |
Custom metrics require Testkube Runner and Control Plane version 2.11.0 or later and a Testkube deployment that uses
Postgres. See Custom Metrics with Influx Line Protocol for the full line format,
the supported field types, and troubleshooting.
Visualizing AI Metrics in Insights
Once a Workflow has run, its AI metrics appear in Test Insights under the Custom Report Metrics group of granular metrics. To chart them:
- Create an Executions Time Series analysis.
- Select an AI metric, such as
promptfoo_eval_pass_rateorragas_eval_faithfulness, as the Measure. - Pick an Aggregate. Insights defaults to maximum for rates and to sum for counts; average is usually the most useful aggregate for a quality score when a Workflow runs several times in one time interval.
- Set the Segment to an identity field, such as
model, to draw one line per model, or filter the analysis to a single Workflow.
Add the analyses you use most to an Insights Board, so that you can follow the quality of your AI application next to its other test results.
Tag each record with the model, prompt version or dataset that the run used, and keep the number of distinct tag values
small. Tags such as model=gpt-4o make it easy to compare runs, while unique values, such as a run ID, create a new
series for every execution.