Toolkit class abstract

A set of tools: their specs in prompt order (which is the order of the tool block, and so of the saved prefix), and how each call is checked, run and described.

Implementers

Constructors

Toolkit()
const
Toolkit.of(List<AssistantTool> tools)
A toolkit over tools, in that order.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
specs → List<ToolSpec>
The tools, in prompt order.
no setter

Methods

coerce(ToolCall call) → Map<String, Object?>
The model's arguments rewritten leniently, before anything checks them (default: unchanged).
confirmationQuestion(ToolCall call, ConfirmationContext context) → String?
The question call asks before it runs; null uses AssistantStrings.confirmDefault.
execute(ToolCall call, ToolContext context) → Future<ToolResult>
Runs call. A model's mistake is a ToolFailure; an exception follows AssistantConfig.toolErrors. The call must start synchronously (before the first await): the assistant reads ToolContext.annotations in the same step.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
A new conversation starts: forget what the old one did (a backend's ledgers).
restoreState(Map<String, Object?> state) → void
Takes back what saveState gave, after a reset.
saveState() → Map<String, Object?>?
What a conversation snapshot keeps of the toolkit; null for nothing.
spec(String name) → ToolSpec?
The spec of name; null for a tool the toolkit does not have (the assistant answers unknown tool).
statusLabel(ToolCall call) → String?
The label shown while call runs; null uses AssistantStrings.working.
timeoutOf(ToolCall call) → Duration?
Longest wait for call's result; null uses AssistantConfig.toolTimeout.
toString() → String
A string representation of this object.
inherited
validate(ToolCall call) → List<String>
The problems of call's (coerced) arguments; empty when valid. Default: validateArguments against the spec.

Operators

operator ==(Object other) → bool
The equality operator.
inherited