Tool<Input extends Object, Options extends ToolOptions, Output extends Object> constructor
Tool<Input extends Object, Options extends ToolOptions, Output extends Object> ({})
A LangChain tool.
The Input
to the tool needs to be described by the inputJsonSchema.
You can easily create a tool from a function using Tool.fromFunction.
If you want to create a tool that accepts a single string input and returns a string output, you can use StringTool or StringTool.fromFunction.
Implementation
Tool({
required this.name,
required this.description,
required this.inputJsonSchema,
this.strict = false,
this.returnDirect = false,
this.handleToolError,
final Options? defaultOptions,
}) : assert(name.isNotEmpty, 'Tool name cannot be empty.'),
assert(description.isNotEmpty, 'Tool description cannot be empty.'),
super(defaultOptions: defaultOptions ?? const ToolOptions() as Options);