Testing LLM features in Spring AI is awkward: the same prompt can pass one run and fail the next, so a plain assertion is either flaky or meaningless.
spring-ai-eval-baseline treats each LLM test as a small experiment:
- `@EvalTest(runs = 10)` runs the method N times and records the pass rate with a confidence interval
- The pass rate is compared with a baseline file; the test fails only on a statistically significant drop (Fisher's exact test), with optional latency and cost limits
- `RecordingChatModel` wraps any Spring AI `ChatModel`: record real answers once, then replay them in CI, offline and for free
- A Markdown report you can post as a pull request comment
Example:
```java
u/EvalTest(runs = 10)
void refundAnswerMentionsTheLimit() {
assertThat(bot.answer("Can I get a refund?")).contains("30 days");
}
```
I use it in one of my own projects: a regression test runs an LLM-based detector on a synthetic test set and fails CI if a prompt change makes detection worse.
Maven Central: `io.github.rrezartprebreza:eval-junit:0.1.0` (MIT, Java 21, Spring AI 1.0)
Repo: https://github.com/rrezartprebreza/spring-ai-eval-baseline
I'd like feedback on the API and the statistics. What would you need before using something like this at work?