Documentation
¶
Overview ¶
Package toolcall is a small tool-correctness suite for voice agents.
Ten short spoken requests each need one tool call; two of them correct themselves mid-sentence. The client really executes every call it receives, computing the answer from that call's own arguments, and returns it after a delay while the agent may still be speaking. A task passes when exactly one call executed, its arguments are the ones asked for (after any correction), and the agent then speaks the result. Nothing here judges wording beyond "the result was said".
Index ¶
- Variables
- func Execute(name string, arguments json.RawMessage) (json.RawMessage, error)
- func Matches(expected, actual map[string]any) bool
- func Run(ctx context.Context, options Options) (bench.Result, error)
- func Score(outcome *bench.TaskOutcome, task Task, transcript bench.Transcript)
- type Options
- type Task
Constants ¶
This section is empty.
Variables ¶
var Tools = []json.RawMessage{ json.RawMessage(`{"type":"function","name":"get_weather","description":"Current weather for a city.","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}`), json.RawMessage(`{"type":"function","name":"add_numbers","description":"Add two numbers.","parameters":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]}}`), json.RawMessage(`{"type":"function","name":"set_timer","description":"Start a countdown timer.","parameters":{"type":"object","properties":{"minutes":{"type":"number"}},"required":["minutes"]}}`), json.RawMessage(`{"type":"function","name":"convert_currency","description":"Convert an amount between currencies (ISO codes such as USD, EUR).","parameters":{"type":"object","properties":{"amount":{"type":"number"},"from":{"type":"string"},"to":{"type":"string"}},"required":["amount","from","to"]}}`), }
Tools are the declarations sent with every task.
Functions ¶
func Execute ¶
func Execute(name string, arguments json.RawMessage) (json.RawMessage, error)
Execute runs a tool for real on its arguments. Unknown tools and unusable arguments return an error object, as a real backend would.
func Matches ¶
Matches reports whether every expected argument is present with an equivalent value: numbers numerically, cities and currencies normalised.
func Score ¶
func Score(outcome *bench.TaskOutcome, task Task, transcript bench.Transcript)
Score reads one transcript against its task.
Types ¶
type Options ¶
type Options struct {
Endpoint, Token, Model string
Cell bench.Cell
Limit int
Timeout time.Duration
// ResultDelay is how long each tool takes. Zero selects two seconds.
ResultDelay time.Duration
WaitConfigured bool
Player bool
Progress func(string)
}
Options configures one run.
type Task ¶
type Task struct {
ID string `json:"id"`
Text string `json:"text"`
Tool string `json:"tool"`
Arguments map[string]any `json:"arguments"`
StaleArguments map[string]any `json:"stale_arguments,omitempty"`
Spoken []string `json:"spoken"`
Audio string `json:"audio"`
}
Task is one spoken request and what a correct agent does with it.