Skip to main content

Class: ObjectGeneratorTool<NAME, PROMPT, PARAMETERS, OBJECT>

A tool that generates an object. You can configure it with a model, an input, an output schema, and a prompt.

Type parameters

NameType
NAMEextends string
PROMPTPROMPT
PARAMETERSPARAMETERS
OBJECTOBJECT

Hierarchy

  • Tool<NAME, PARAMETERS, OBJECT>

    ObjectGeneratorTool

Constructors

constructor

new ObjectGeneratorTool<NAME, PROMPT, PARAMETERS, OBJECT>(«destructured»): ObjectGeneratorTool<NAME, PROMPT, PARAMETERS, OBJECT>

Type parameters

NameType
NAMEextends string
PROMPTPROMPT
PARAMETERSPARAMETERS
OBJECTOBJECT

Parameters

NameType
«destructured»Object
› description?string
› modelObjectGenerationModel<PROMPT, ObjectGenerationModelSettings>
› name?NAME
› objectSchemaSchema<OBJECT> & JsonSchemaProducer
› parametersSchema<PARAMETERS> & JsonSchemaProducer
› prompt(input: PARAMETERS) => PromptFunction<PARAMETERS, PROMPT>

Returns

ObjectGeneratorTool<NAME, PROMPT, PARAMETERS, OBJECT>

Overrides

Tool.constructor

Defined in

packages/modelfusion/src/tool/ObjectGeneratorTool.ts:20

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.

Inherited from

Tool.description

Defined in

packages/modelfusion/src/tool/Tool.ts:22


execute

Readonly execute: (args: PARAMETERS, options: FunctionCallOptions) => PromiseLike<OBJECT>

The actual execution function of the tool.

Type declaration

▸ (args, options): PromiseLike<OBJECT>

The actual execution function of the tool.

Parameters
NameType
argsPARAMETERS
optionsFunctionCallOptions
Returns

PromiseLike<OBJECT>

Inherited from

Tool.execute

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.

Inherited from

Tool.name

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.

Inherited from

Tool.parameters

Defined in

packages/modelfusion/src/tool/Tool.ts:28


returnType

Optional Readonly returnType: Schema<OBJECT>

An optional schema of the output that the tool produces. This will be used to validate the output.

Inherited from

Tool.returnType

Defined in

packages/modelfusion/src/tool/Tool.ts:33