pub enum Expectation {
CalledTool {
tool: String,
},
DidNotCallTool {
tool: String,
},
CalledToolWith {
tool: String,
args: Value,
},
ToolCallCount {
tool: Option<String>,
min: Option<usize>,
max: Option<usize>,
},
CalledToolsInOrder {
tools: Vec<String>,
},
NoToolCalls,
FinalTextContains {
text: String,
case_insensitive: bool,
},
FinalTextEquals {
text: String,
},
FinalTextMatches {
regex: String,
},
FinalNumberEquals {
value: f64,
tolerance: f64,
},
NoError,
}Expand description
A single built-in assertion over a run’s RunArtifacts.
A case PASSES iff the run did not error AND every Expectation holds. Evaluate one against a run via
Expectation::evaluate (or let BuiltinScorer +
run_suite do it). Each variant produces a clear, report-ready label via
Expectation::label.
Variants§
CalledTool
The agent called tool at least once (any args).
DidNotCallTool
The agent did NOT call tool at all.
CalledToolWith
The agent called tool at least once with args that SUPERSET the given args (subset match —
see the module docs). The canonical “called X with these parameters” assertion.
Fields
ToolCallCount
The number of tool calls is within [min, max] (each optional). When tool is Some, only
calls to that tool are counted; when None, ALL calls are counted.
Fields
CalledToolsInOrder
The named tools appear as a SUBSEQUENCE of the call order (in order, but not necessarily
contiguous — other calls may be interleaved). Empty tools trivially holds.
NoToolCalls
The agent made NO tool calls at all (a pure-reasoning / refusal assertion).
FinalTextContains
final_text contains text (optionally case-insensitively). Fails when there is no final text.
Fields
FinalTextEquals
final_text equals text exactly (after trimming surrounding whitespace on both sides). Fails
when there is no final text.
FinalTextMatches
final_text matches the regex (anywhere, via regex::Regex::is_match). A malformed regex
is a hard EvalError::Regex from Expectation::evaluate (NOT a silent failure). Fails when
there is no final text.
FinalNumberEquals
The LAST number in final_text equals value within tolerance (see the module docs for the
extraction rule). Fails when there is no final text or it contains no number.
Fields
NoError
The run reported no error (RunArtifacts::error is None). The runner already fails a case on
any run error, so this is mostly for an explicit, labeled “the run was clean” predicate.
Implementations§
Source§impl Expectation
impl Expectation
Sourcepub fn evaluate(
&self,
artifacts: &RunArtifacts,
) -> Result<(String, bool), EvalError>
pub fn evaluate( &self, artifacts: &RunArtifacts, ) -> Result<(String, bool), EvalError>
Evaluate this expectation against a run’s artifacts, returning (label, passed).
The label identifies WHICH predicate it is (for the report’s per-predicate diagnostics), matching
the labeling style of a hand-rolled scorer. The ONLY fallible case is
FinalTextMatches with a malformed regex, which returns
EvalError::Regex; every other variant is infallible.
Trait Implementations§
Source§impl Clone for Expectation
impl Clone for Expectation
Source§fn clone(&self) -> Expectation
fn clone(&self) -> Expectation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more