Skip to main content

Class: TextGenerationToolCallModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextGenerationModel<TARGET_PROMPT, TextGenerationModelSettings>

Implements

Accessors

modelInformation

get modelInformation(): ModelInformation

Returns

ModelInformation

Implementation of

ToolCallGenerationModel.modelInformation

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:37


settings

get settings(): TextGenerationModelSettings

Returns

TextGenerationModelSettings

Implementation of

ToolCallGenerationModel.settings

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:41


settingsForEvent

get settingsForEvent(): Partial<MODEL["settings"]>

Returns settings that should be recorded in observability events. Security-related settings (e.g. API keys) should not be included here.

Returns

Partial<MODEL["settings"]>

Implementation of

ToolCallGenerationModel.settingsForEvent

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:45

Constructors

constructor

new TextGenerationToolCallModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>(«destructured»): TextGenerationToolCallModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextGenerationModel<TARGET_PROMPT, TextGenerationModelSettings>

Parameters

NameType
«destructured»Object
› modelMODEL
› templateToolCallPromptTemplate<SOURCE_PROMPT, TARGET_PROMPT>

Returns

TextGenerationToolCallModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:26

Methods

doGenerateToolCall

doGenerateToolCall(tool, prompt, options?): Promise<{ rawResponse: unknown ; toolCall: null | { args: unknown ; id: string } ; usage: undefined | { completionTokens: number ; promptTokens: number ; totalTokens: number } }>

Parameters

NameType
toolToolDefinition<string, unknown>
promptSOURCE_PROMPT
options?FunctionOptions

Returns

Promise<{ rawResponse: unknown ; toolCall: null | { args: unknown ; id: string } ; usage: undefined | { completionTokens: number ; promptTokens: number ; totalTokens: number } }>

Implementation of

ToolCallGenerationModel.doGenerateToolCall

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:60


getModelWithJsonOutput

getModelWithJsonOutput(schema): MODEL

Parameters

NameType
schemaSchema<unknown> & JsonSchemaProducer

Returns

MODEL

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:49


withSettings

withSettings(additionalSettings): this

The withSettings method creates a new model with the same configuration as the original model, but with the specified settings changed.

Parameters

NameType
additionalSettingsPartial<MODEL["settings"]>

Returns

this

Example

const model = new OpenAICompletionModel({
model: "gpt-3.5-turbo-instruct",
maxGenerationTokens: 500,
});

const modelWithMoreTokens = model.withSettings({
maxGenerationTokens: 1000,
});

Implementation of

ToolCallGenerationModel.withSettings

Defined in

packages/modelfusion/src/tool/generate-tool-call/TextGenerationToolCallModel.ts:93