Class ExperimentRunner
Per case: load the recorded tool calls, if any, into the bound stubs, call the agent in a fresh session, read the evidence the runtime traced for that session, and evaluate the expectations over it. The stubs a hand written case needs are prepared before the run, in the test.
An experiment is built in steps, each step offering only what comes next: the cases with
optional evaluators and ToolBindings, the agent, an optional Gate, then Experiment.run(). Without a gate every case must pass, which suits a mocked model. With a real
model gate on rates instead.
Experiment.repeat(int) runs every case several times. One execution of one case is an
attempt, and the gate, the rates and the spend count attempts. The report names the requirements
that passed in some runs and failed in others.
Experiment.run() writes the report as JSON to target/eval-reports/<name>-<start
time>.json, see ExperimentRunner.EvalReport.reportFile().
The cases carry the command the agent's command handler takes, so the handler's own type is passed through unchanged.
var runner = new ExperimentRunner(testKit);
var report =
runner.cases(cases).agent(SupportAgent::ask).gate(Gate.passRateShouldBeAtLeast(0.9)).run();
assertThat(report.passed()).withFailMessage(report::render).isTrue();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne attempt: one case's evidence and results from one run.static final recordOne case over all its runs.static interfaceThe batch outcome: the attempts, the cases over their runs, and the gate's verdict.static enumThe outcome of a case over all its runs, or of a requirement over its conclusive runs.static final recordOne requirement of a case over all runs: one evaluator at one position in the results of the case's attempts. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PathWhereExperiment.run()writes the report file unless the experiment names another. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <C> ExperimentCases<C> The cases the experiment runs.<C> ExperimentCases<C> The cases the experiment runs.
-
Field Details
-
DEFAULT_REPORT_DIRECTORY
WhereExperiment.run()writes the report file unless the experiment names another.
-
-
Constructor Details
-
ExperimentRunner
- Parameters:
testKit- the running TestKit the agent is called through
-
-
Method Details
-
cases
The cases the experiment runs.- Parameters:
first- the first casemore- further cases, with the same command type
-
cases
The cases the experiment runs.- Parameters:
cases- at least one case
-