Tools
A "tool" is a utility that can be called by an agent on behalf of an LLM. A tool can be called to perform custom actions, or retrieve extra information based on the LLM-generated input. A result from a tool call can be used by subsequent steps in a workflow, or to compute a final answer. For example, a "weather tool" could fetch some live weather information from a geographical location.
Function tool
Function tools are implemented with the FunctionTool
class.
A FunctionTool
is constructed from a function with signature
where
input
is generated by the LLM,T
is the type defined by the toolparameters
additionalArg
is an optional extra argument, see "Binding" belowR
is the return type
Binding
An additional argument can be bound to a tool, each tool call will be passed
- the input provided by the LLM
- the additional argument (extends object)
Note: calling the bind
method will return a new FunctionTool
instance, without modifying the tool which bind
is called on.
Example to pass a userToken
as additional argument:
Last updated on