Package akka.javasdk.testkit.eval
Interface Judge
- All Known Implementing Classes:
ModelBasedJudge
public interface Judge
Decides how well a reply meets a criterion given as a sentence.
shouldSatisfy(java.lang.String) and shouldScoreAtLeast(java.lang.String, double) turn the score into an Evaluator.
var judge = Judge.modelBased(testKit);
EvalCase.of(
"tier",
"Which tier is cust_1 on?",
Evaluators.shouldCallTool("getCustomer"),
judge.shouldSatisfy("the reply states the customer's tier and invents nothing"));
modelBased(akka.javasdk.testkit.TestKit) asks a model through JudgeAgent, which uses the model provider of
the test configuration. A test can also return a Judge.Verdict directly, or mock that agent's
model.
A judged score can differ between runs of the same reply. Use a judge for criteria that have no exact answer to compare against, and gate a batch on the rate instead of asserting per case.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondecide(String criterion, Interaction interaction) static ModelBasedJudgemodelBased(TestKit testKit) A judge that asks a model throughJudgeAgent, using the TestKit component client.default EvaluatorshouldSatisfy(String criterion) Same asshouldScoreAtLeast(java.lang.String, double)with a threshold of 0.5.default EvaluatorshouldScoreAtLeast(String criterion, double threshold) The criterion must score at leastthreshold.
-
Method Details
-
decide
- Parameters:
criterion- what a good reply does, as one sentenceinteraction- the input, the reply and the evidence the case produced
-
modelBased
A judge that asks a model throughJudgeAgent, using the TestKit component client. -
shouldScoreAtLeast
The criterion must score at leastthreshold. Inconclusive when there is no reply. Fails when the judge throws or gives no verdict, or when the score is not between 0 and 1. -
shouldSatisfy
Same asshouldScoreAtLeast(java.lang.String, double)with a threshold of 0.5.
-