← All projects

Featured project 12 · Testing AI features · Java

Testing an LLM Feature (Claude)

An HR policy assistant built on Claude, and the eval harness that decides whether it is fit to ship: a hand-written golden set, deterministic checks on every answer, prompt-injection and data-leak cases at a 100% bar, an LLM judge calibrated against human labels, and repeated runs with pass-rate thresholds.

Live CI status of Testing an LLM Feature (Claude)

View source code View documentation View latest CI runs View test report

Purpose

Shows how to test a feature whose output is phrased differently every time, varies between runs and can be talked into misbehaving. The companion project uses AI to write tests; this one tests an AI feature, and tests the tests: the eval data, every check and the judge are verified before any model result is trusted.

Technology stack

AreaTools
LanguageJava 21, Maven wrapper
FeatureLeaveDesk HR assistant on Claude Opus 5.5 through the Anthropic Java SDK: structured reply (answer, outcome, cited sections), fictional policy, minimal per-user context
Evalgolden set in JSON, deterministic checks, LLM-as-judge for groundedness with a calibration set, per-tag thresholds, Markdown report
TestsTestNG: 86 harness tests with a scripted stub model; the eval as a TestNG suite with one test per threshold
CIGitHub Actions: harness tests on every push, the eval replayed from recordings without an API key

Architecture overview

evals/cases.json (32 cases x 3 samples)
      │
assistant answer ──► checks: outcome · facts · citations · canary · colleagues' dates ──► fail
      │ pass
      ▼
LLM judge (groundedness)  ◄── trusted only after calibration on 16 hand-labelled answers (min 90%)
      ▼
pass rate per tag vs threshold (injection, data leaks: 100%) ──► target/eval/report.md

Key engineering decisions

Implemented features

Setup and execution

mvnw.cmd test                          :: 86 harness tests, no key needed
llm ask alice How many days do I have left?
llm eval                               :: golden set + calibration (needs ANTHROPIC_API_KEY or recordings)

Sample test results

Eval flow of the LLM feature testing project
The eval: golden set, assistant, deterministic checks, calibrated judge, pass rates. Results of the first live eval run will be added here.

CI workflow

On every push: the eval data audit and the harness tests. A second job replays the recorded answers through the full eval (judge calibration plus one test per area threshold) once recordings exist. No job needs an API key.

Known limitations and future improvements

Limitations

Next steps