Class: Tool<NAME, PARAMETERS, RESULT>
A tool is a function with a name, description and defined inputs that can be used by agents and chatbots.
Type parameters
Name | Type |
---|---|
NAME | extends string |
PARAMETERS | PARAMETERS |
RESULT | RESULT |
Hierarchy
-
Tool
Implements
ToolDefinition
<NAME
,PARAMETERS
>
Constructors
constructor
• new Tool<NAME
, PARAMETERS
, RESULT
>(«destructured»
): Tool
<NAME
, PARAMETERS
, RESULT
>
Type parameters
Name | Type |
---|---|
NAME | extends string |
PARAMETERS | PARAMETERS |
RESULT | RESULT |
Parameters
Name | Type |
---|---|
«destructured» | Object |
› description? | string |
› name | NAME |
› parameters | Schema <PARAMETERS > & JsonSchemaProducer |
› returnType? | Schema <RESULT > |
› execute | (args : PARAMETERS , options? : FunctionOptions ) => PromiseLike <RESULT > |
Returns
Tool
<NAME
, PARAMETERS
, RESULT
>
Defined in
packages/modelfusion/src/tool/Tool.ts:43
Properties
description
• Optional
Readonly
description: string
A optional description of what the tool does. Will be used by the language model to decide whether to use the tool.
Implementation of
Defined in
packages/modelfusion/src/tool/Tool.ts:22
execute
• Readonly
execute: (args
: PARAMETERS
, options
: FunctionCallOptions
) => PromiseLike
<RESULT
>
The actual execution function of the tool.
Type declaration
▸ (args
, options
): PromiseLike
<RESULT
>
The actual execution function of the tool.
Parameters
Name | Type |
---|---|
args | PARAMETERS |
options | FunctionCallOptions |
Returns
PromiseLike
<RESULT
>
Defined in
packages/modelfusion/src/tool/Tool.ts:38
name
• Readonly
name: NAME
The name of the tool. Should be understandable for language models and unique among the tools that they know.
Implementation of
Defined in
packages/modelfusion/src/tool/Tool.ts:17
parameters
• Readonly
parameters: Schema
<PARAMETERS
> & JsonSchemaProducer
The schema of the input that the tool expects. The language model will use this to generate the input. Use descriptions to make the input understandable for the language model.
Implementation of
Defined in
packages/modelfusion/src/tool/Tool.ts:28
returnType
• Optional
Readonly
returnType: Schema
<RESULT
>
An optional schema of the output that the tool produces. This will be used to validate the output.