Skip to main content

Class: ObjectFromTextGenerationModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextGenerationModel<TARGET_PROMPT, TextGenerationModelSettings>

Hierarchy

Implements

Accessors

modelInformation

get modelInformation(): ModelInformation

Returns

ModelInformation

Implementation of

ObjectGenerationModel.modelInformation

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:36


settings

get settings(): TextGenerationModelSettings

Returns

TextGenerationModelSettings

Implementation of

ObjectGenerationModel.settings

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:40


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

ObjectGenerationModel.settingsForEvent

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:44

Constructors

constructor

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

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextGenerationModel<TARGET_PROMPT, TextGenerationModelSettings>

Parameters

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

Returns

ObjectFromTextGenerationModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:25

Methods

doGenerateObject

doGenerateObject(schema, prompt, options?): Promise<{ rawResponse: unknown ; value: unknown ; valueText: string = text }>

Parameters

NameType
schemaSchema<unknown> & JsonSchemaProducer
promptSOURCE_PROMPT
options?FunctionOptions

Returns

Promise<{ rawResponse: unknown ; value: unknown ; valueText: string = text }>

Implementation of

ObjectGenerationModel.doGenerateObject

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:59


getModelWithJsonOutput

getModelWithJsonOutput(schema): MODEL

Parameters

NameType
schemaSchema<unknown> & JsonSchemaProducer

Returns

MODEL

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:48


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

ObjectGenerationModel.withSettings

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:85