ToolCall class final

One call: the tool's name and its arguments, typed from the tool's schema by the parser. Value equality, deep on arguments.

Annotations
  • @immutable

Constructors

ToolCall(String name, [Map<String, Object?> arguments = const {}])
const
ToolCall.fromJson(Map<String, Object?> json)
{'tool': name, 'args': {...}}, the compact form of a call (what toJson writes); also {'name': name, 'arguments': {...}}, where the arguments may be a JSON string. Missing arguments are {}. Throws FormatException when there is no name or the arguments are not an object.
factory

Properties

arguments → Map<String, Object?>
The arguments by name, in the order the model wrote them.
final
hashCode → int
The hash code for this object.
no setteroverride
key → String
'$name ${jsonEncode(arguments)}': equal for two calls with the same arguments in the same order.
no setter
name → String
The tool's name.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

boolean(String k) → bool?
The argument k when it is a boolean or the string true or false, else null.
integer(String k) → int?
The argument k when it is an integer, a whole double or a string holding an integer, else null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requireString(String k) → String
The argument k as string reads it; throws ArgumentError when it is missing or not a string.
string(String k) → String?
The argument k when it is a string, else null.
toJson() → Map<String, Object?>
{'tool': name, 'args': arguments}.
toString() → String
A string representation of this object.
override

Operators

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