Introducing Confident Monitor

Tool Correctness

Tool Correctness is a single-turn metric to determine an agent's tool calling ability

Overview

The tool correctness metric is a single-turn metric that evaluates your LLM agent's ability to call tools correctly. Unlike other metrics, it does not use an LLM for evaluation.

Required Parameters

These are the parameters you must supply in your test case to run evaluations for tool correctness metric:

inputstringRequired

The input supplied to your LLM agent.

actual_outputstringRequired

The final output your LLM agent generated for the given input.

tools_calledlistRequired

A list of the tools called by your LLM agent in the order of their calling in a ToolCall instance.

expected_toolsstringRequired

A list of the expected tools to be called by your LLM agent in the order of how they should be called in a ToolCall instance.

Metric Parameters

These are the parameters you can configure for tool correctness metric when adding it to a metric collection:

should_exact_matchboolean

Require the tools called to exactly match the expected tools — same tools, same count, and same order.

should_consider_orderingboolean

Require the expected tools to be called in the same order. Ignored when exact match is enabled.

How Is It Calculated?

The tool correctness metric uses a deterministic approach to calculate the score by iterating over the tools called and expected tools to see if your agent has called the appropriate tools.


Tool Correctness=Number of Correctly Used Tools(or Correct Input Parameters / Outputs)Total Number of Tools Called\text{Tool Correctness} = \frac{\text{Number of Correctly Used Tools(or Correct Input Parameters / Outputs)}}{\text{Total Number of Tools Called}}

The final score is the proportion of correctly used tools from tools called.

Usage

To run the tool correctness metric on Confident AI, add it to a single-turn metric collection. This will allow you to use tool correctness metric for:

  • Single-turn E2E testing
  • Single-turn component-level testing
  • Online and offline evals for traces and spans

Last updated on

Built byConfident AI