Skip to main content

Class: ObjectFromTextStreamingModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextStreamingModel<TARGET_PROMPT, TextGenerationModelSettings>

Hierarchy

Implements

Accessors

modelInformation

get modelInformation(): ModelInformation

Returns

ModelInformation

Implementation of

ObjectStreamingModel.modelInformation

Inherited from

ObjectFromTextGenerationModel.modelInformation

Defined in

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


settings

get settings(): TextGenerationModelSettings

Returns

TextGenerationModelSettings

Implementation of

ObjectStreamingModel.settings

Inherited from

ObjectFromTextGenerationModel.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

ObjectStreamingModel.settingsForEvent

Inherited from

ObjectFromTextGenerationModel.settingsForEvent

Defined in

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

Constructors

constructor

new ObjectFromTextStreamingModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>(options): ObjectFromTextStreamingModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Type parameters

NameType
SOURCE_PROMPTSOURCE_PROMPT
TARGET_PROMPTTARGET_PROMPT
MODELextends TextStreamingModel<TARGET_PROMPT, TextGenerationModelSettings>

Parameters

NameType
optionsObject
options.modelMODEL
options.templateObjectFromTextPromptTemplate<SOURCE_PROMPT, TARGET_PROMPT>

Returns

ObjectFromTextStreamingModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>

Overrides

ObjectFromTextGenerationModel.constructor

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:27

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

ObjectStreamingModel.doGenerateObject

Inherited from

ObjectFromTextGenerationModel.doGenerateObject

Defined in

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


doStreamObject

doStreamObject(schema, prompt, options?): Promise<AsyncQueue<Delta<string>>>

Parameters

NameType
schemaSchema<unknown> & JsonSchemaProducer
promptSOURCE_PROMPT
options?FunctionOptions

Returns

Promise<AsyncQueue<Delta<string>>>

Implementation of

ObjectStreamingModel.doStreamObject

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:34


extractObjectTextDelta

extractObjectTextDelta(delta): string

Parameters

NameType
deltaunknown

Returns

string

Implementation of

ObjectStreamingModel.extractObjectTextDelta

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:63


getModelWithJsonOutput

getModelWithJsonOutput(schema): MODEL

Parameters

NameType
schemaSchema<unknown> & JsonSchemaProducer

Returns

MODEL

Inherited from

ObjectFromTextGenerationModel.getModelWithJsonOutput

Defined in

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


parseAccumulatedObjectText

parseAccumulatedObjectText(accumulatedText): unknown

Parameters

NameType
accumulatedTextstring

Returns

unknown

Implementation of

ObjectStreamingModel.parseAccumulatedObjectText

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:67


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

ObjectStreamingModel.withSettings

Overrides

ObjectFromTextGenerationModel.withSettings

Defined in

packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:71