Class Evaluators
Each factory returns an Evaluator for one check over the reply and the traced tool
calls. An evaluator reads only the evidence it names and is inconclusive when that evidence is
absent: a tool that was never called fails shouldCallTools(java.lang.String...), and shouldCallToolWith(java.lang.String, java.lang.String, java.lang.Object) is inconclusive. Give the evaluators to an EvalCase, next to a
Judge or a custom evaluator.
Each built-in is a public nested record carrying an EvalLabel. Pass its class to
Gate.passRateShouldBeAtLeast(Class, double), for example
Evaluators.ToolArgument.class. TARGET and SETUP are reported by the runner
when a case did not reach evaluation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe label used in the report to group the evaluator's results.static EvaluatorreplyShouldContain(String... texts) The reply must contain every given text, case-insensitively.static EvaluatorreplyShouldMatch(String regex) The reply must match the regular expression, anywhere in it.static EvaluatorreplyShouldMatch(Pattern pattern) The reply must match the pattern, anywhere in it.static EvaluatorreplyShouldNotContain(String... texts) The reply must not contain any of the given texts, case-insensitively.static EvaluatorreplyShouldNotContainLuhnNumber(int minDigits, int maxDigits) The reply must not contain a sequence of digits within this length range that passes the Luhn checksum.static EvaluatorThe reply must not contain a payment card number.static EvaluatorreplyShouldNotMatch(String regex) The reply must not match the regular expression anywhere in it.static EvaluatorreplyShouldNotMatch(Pattern pattern) The reply must not match the pattern anywhere in it.static EvaluatorshouldCallTool(String name) This tool must be called.static EvaluatorshouldCallTools(String... names) These tools must be called, in any order.static EvaluatorshouldCallToolsInOrder(String... names) These tools must be called in this relative order.static EvaluatorshouldCallToolWith(String tool, String argument, Object value) The named tool must be called with this argument value.static EvaluatorshouldMakeAtMostModelCalls(int calls) The agent may make at most this many model calls while replying.static EvaluatorshouldMakeAtMostToolCalls(int calls) The agent may make at most this many tool calls while replying.static EvaluatorshouldNotCallTool(String name) This tool may not be called.static EvaluatorshouldNotCallTools(String... names) None of these tools may be called.static EvaluatorshouldReplyWithin(Duration latency) The agent command must complete within this time.static EvaluatorshouldUseAtMostTokens(long tokens) The turn may use at most this many tokens, input and output together.static EvaluatortoolResultShouldContain(String tool, String text) The result of the named tool must contain this text, case-insensitively.
-
Field Details
-
CUSTOM_PREFIX
The prefix added to the label of a custom evaluator.- See Also:
-
TARGET
The agent call failed.- See Also:
-
SETUP
Loading the case's recorded calls into the stubs threw, so the agent was never called.- See Also:
-
-
Method Details
-
label
The label used in the report to group the evaluator's results. It is theEvalLabelvalue, withCUSTOM_PREFIXadded for a custom evaluator.- Throws:
IllegalArgumentException- when the class carries no label, a blank label, or a label that starts withCUSTOM_PREFIX
-
shouldCallTools
These tools must be called, in any order. Other calls are allowed. -
shouldCallTool
This tool must be called. Other calls are allowed. -
shouldCallToolsInOrder
These tools must be called in this relative order. Calls to other tools may come between. Inconclusive when one of them was never called. -
shouldCallToolWith
The named tool must be called with this argument value. Numbers compare by value. Inconclusive when the tool was never called. -
toolResultShouldContain
The result of the named tool must contain this text, case-insensitively. Inconclusive when the tool was never called or the trace carries no result for it. -
shouldNotCallTools
None of these tools may be called. -
shouldNotCallTool
This tool may not be called. -
shouldMakeAtMostToolCalls
The agent may make at most this many tool calls while replying. -
shouldMakeAtMostModelCalls
The agent may make at most this many model calls while replying. Inconclusive when the trace carried no model calls. -
shouldUseAtMostTokens
The turn may use at most this many tokens, input and output together. Inconclusive when no model call reported tokens, as with a mocked model. -
shouldReplyWithin
The agent command must complete within this time. Inconclusive when the trace carries no timing. -
replyShouldContain
The reply must contain every given text, case-insensitively. -
replyShouldMatch
The reply must match the regular expression, anywhere in it. Anchor it for a full match. The expression is compiled withPattern.DOTALL, so.also matches line breaks. -
replyShouldMatch
The reply must match the pattern, anywhere in it. Anchor the pattern for a full match. -
replyShouldNotContain
The reply must not contain any of the given texts, case-insensitively. -
replyShouldNotMatch
The reply must not match the regular expression anywhere in it. The expression is compiled withPattern.DOTALL, so.also matches line breaks. -
replyShouldNotMatch
The reply must not match the pattern anywhere in it. -
replyShouldNotContainLuhnNumber
The reply must not contain a sequence of digits within this length range that passes the Luhn checksum. Spaces and dashes are allowed between the digits.The Luhn checksum validates many identifiers besides payment cards, and each has its own length: an IMEI has 15 digits, a South African ID 13, a Canadian Social Insurance Number 9.
-
replyShouldNotContainPaymentCard
The reply must not contain a payment card number. A card number is a run of 13 to 19 digits, spaces and dashes allowed between them, that passes the Luhn checksum.
-