Version: 0.0.8 (stable)
agrag.eval.trajectory.expected_tools_metric
expected_tools_metric(names:Sequence[str | Sequence[str]], *, threshold:float = 0.5) -> ScoreMetric
Build the metric that the run made every expected tool call, in order.
Matches the expected entries against the trajectory's tool call names, ignoring arguments: every entry must be satisfied, in order, as a subsequence of the calls, and extra calls do not matter. A name is satisfied by a call to that name; a nested sequence by a call to any one of its names. A repeated entry needs a separate call per occurrence, so discovery before fetch and repeated searches are both enforced. Scores 1.0 or 0.0.
Parameters:
- names (
Sequence[str | Sequence[str]]) – The tool calls the run must make, in order. Each item is one required name, or a non-empty set of alternative names of which the run must have called at least one. - threshold (
float) – The minimum score that counts as success.
Returns:
ScoreMetric– AScoreMetricthat scores tool presence and order.
Raises:
ValueError– An alternative group holds no names.