Package akka.javasdk.testkit.eval
Record Class EvalCase<C>
- Type Parameters:
C- the command handler's parameter type- Record Components:
id- unique within the suite; names the case in the reportcommand- the command sent to the agentrecordedCalls- the tool calls a recording carried, in recorded order. Empty for a case written by handevaluators- the checks over the reply and the tool calls: built-ins fromEvaluators, aJudgecriterion, or a customEvaluator. Each is a class annotated withEvalLabel. Empty when the case only collects evidence
public record EvalCase<C>(String id, C command, List<RecordedCall> recordedCalls, List<Evaluator> evaluators)
extends Record
One evaluation case: the command sent to the agent and the evaluators to run against the agent's
reply and tool calls.
The command is what the agent's command handler takes. It is a String for a handler that takes the user message directly, or the handler's own type, such as a record with several fields. All cases of one experiment must have the same command type.
EvalCase.of("tier", "Which tier is cust_1 on?", Evaluators.shouldCallTools("getCustomer"));
EvalCase.of(
"tier-of-the-caller",
new Ask("cust_1", "Which tier am I on?"),
Evaluators.shouldCallTools("getCustomer"));
The stubs the agent's tools call are prepared before the experiment runs, in the test. A case
derived from a recording also carries the tool calls production made, and the runner loads their
results into the stubs through the ToolBindings given to it before the case's turn.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommand()Returns the value of thecommandrecord component.The command as the text aJudgereads: a String command as is, any other command as JSON.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theevaluatorsrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.static <C> EvalCase<C> Returns the value of therecordedCallsrecord component.final StringtoString()Returns a string representation of this record class.withEvaluators(Evaluator... more) The same case with these evaluators added.withoutEvaluators(Class<? extends Evaluator>... types) The same case without the evaluators of these classes, for exampleEvaluators.TokenBudget.classunder a mocked model that reports no tokens.
-
Constructor Details
-
EvalCase
Creates an instance of aEvalCaserecord class.- Parameters:
id- the value for theidrecord componentcommand- the value for thecommandrecord componentrecordedCalls- the value for therecordedCallsrecord componentevaluators- the value for theevaluatorsrecord component
-
-
Method Details
-
of
-
commandText
The command as the text aJudgereads: a String command as is, any other command as JSON. This is what theInteractioncarries as its input. -
withEvaluators
The same case with these evaluators added. -
withoutEvaluators
The same case without the evaluators of these classes, for exampleEvaluators.TokenBudget.classunder a mocked model that reports no tokens. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
command
Returns the value of thecommandrecord component.- Returns:
- the value of the
commandrecord component
-
recordedCalls
Returns the value of therecordedCallsrecord component.- Returns:
- the value of the
recordedCallsrecord component
-
evaluators
Returns the value of theevaluatorsrecord component.- Returns:
- the value of the
evaluatorsrecord component
-