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
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
callasks before it runs; null usesAssistantStrings.confirmDefault. -
execute(
ToolCall call, ToolContext context) → Future< ToolResult> -
Runs
call. A model's mistake is a ToolFailure; an exception followsAssistantConfig.toolErrors. The call must start synchronously (before the firstawait): the assistant readsToolContext.annotationsin 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 answersunknown tool). -
statusLabel(
ToolCall call) → String? -
The label shown while
callruns; null usesAssistantStrings.working. -
timeoutOf(
ToolCall call) → Duration? -
Longest wait for
call's result; null usesAssistantConfig.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