Record Class EvalCase<C>

Object
Record
akka.javasdk.testkit.eval.EvalCase<C>
Type Parameters:
C - the command handler's parameter type
Record Components:
id - unique within the suite; names the case in the report
command - the command sent to the agent
recordedCalls - the tool calls a recording carried, in recorded order. Empty for a case written by hand
evaluators - the checks over the reply and the tool calls: built-ins from Evaluators, a Judge criterion, or a custom Evaluator. Each is a class annotated with EvalLabel. 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 Details

    • EvalCase

      public EvalCase(String id, C command, List<RecordedCall> recordedCalls, List<Evaluator> evaluators)
      Creates an instance of a EvalCase record class.
      Parameters:
      id - the value for the id record component
      command - the value for the command record component
      recordedCalls - the value for the recordedCalls record component
      evaluators - the value for the evaluators record component
  • Method Details

    • of

      public static <C> EvalCase<C> of(String id, C command, Evaluator... evaluators)
    • commandText

      public String commandText()
      The command as the text a Judge reads: a String command as is, any other command as JSON. This is what the Interaction carries as its input.
    • withEvaluators

      public EvalCase<C> withEvaluators(Evaluator... more)
      The same case with these evaluators added.
    • withoutEvaluators

      @SafeVarargs public final EvalCase<C> withoutEvaluators(Class<? extends Evaluator>... types)
      The same case without the evaluators of these classes, for example Evaluators.TokenBudget.class under a mocked model that reports no tokens.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • command

      public C command()
      Returns the value of the command record component.
      Returns:
      the value of the command record component
    • recordedCalls

      public List<RecordedCall> recordedCalls()
      Returns the value of the recordedCalls record component.
      Returns:
      the value of the recordedCalls record component
    • evaluators

      public List<Evaluator> evaluators()
      Returns the value of the evaluators record component.
      Returns:
      the value of the evaluators record component