Spring AI Evaluation Framework
An evaluation framework for Spring AI applications. Run datasets against your RAG or chat target, score the results with retrieval, answer and LLM-judge metrics, and fail the build when quality drops.
What it does
Judge metrics send the question, answer and retrieved chunks to the judge model. With a cloud model, that data leaves your machine. Deterministic metrics call no model.
The artifacts are not on Maven Central yet (planned coordinates: dev.agentworkshq, eval-framework-spring-boot-starter, 0.1.0-SNAPSHOT).
Datasets
- YAML, JSON and JSONL. Cases have an id and a question, plus optional expected answer, expected sources, must-contain and must-not-contain phrases, tags and a no-answer flag. Parsing is strict, and limits apply (5 MB per file, 1000 cases by default).
Metrics
- Retrieval metrics. Hit at k, recall at k, precision at k and reciprocal rank, against expected sources.
- Answer and citation metrics. Contains and not-contains phrases, regex, no-answer, citation, citation grounding and latency.
- LLM-judge metrics. Faithfulness, answer relevancy and correctness, scored 1 to 5 with optional repeats. Judge prompts wrap data in random delimiters and replies are parsed strictly. Any Spring AI Evaluator can also be wrapped as a metric.
Running
- Bounded runs. Per-case, per-metric and total timeouts, optional retries, concurrency up to 16, and a judge call budget. A run that hits a budget ends as skipped cases, not a silent pass.
- Deterministic output. Cases are sorted by id and results collected by id, so reports are stable between runs.
Regression gate
- Baselines. Save a run, commit it as a baseline, and compare later runs. Metrics are marked regressed when the mean or pass rate drops beyond a tolerance, or errors increase. Cases that passed and now fail are listed.
- JUnit assertions. EvalAssertions.assertGate fails the test with a console report. Thresholds cover pass rate, mean score, incomplete cases and metric errors.
- Reports. Console, Markdown (for a pull request comment) and JSON reports. They never contain question, answer or chunk text.
Why it exists
RAG answers change when prompts, models or data change, and a manual spot check misses regressions. This framework turns that check into a repeatable test with a baseline. The README notes that version 0.1 has no significance test and relies on tolerances and repeats, and that judge metrics are only as stable as the judge model.