Tool<TInput extends Object> class

A tool that can be called by the LLM.

Constructors

Tool.new({required String name, required String description, required FutureOr onCall(TInput input), JsonSchema? inputSchema, TInput inputFromJson(Map<String, dynamic>)?})
Creates a Tool.

Properties

description String
Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description.
final
hashCode int
The hash code for this object.
no setterinherited
inputSchema → JsonSchema
Schema to parse and validate tool's input arguments. Following the JSON Schema specification.
final
name String
The unique name of the tool that clearly communicates its purpose.
final
onCall FutureOr Function(TInput input)
The function that will be called when the tool is run.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Map<String, dynamic> arguments) Future
Runs the tool.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the tool to a JSON-serializable map.
toString() String
A string representation of this object.
inherited

Operators

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