Class: ObjectFromTextStreamingModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>
Type parameters
Name | Type |
---|---|
SOURCE_PROMPT | SOURCE_PROMPT |
TARGET_PROMPT | TARGET_PROMPT |
MODEL | extends TextStreamingModel <TARGET_PROMPT , TextGenerationModelSettings > |
Hierarchy
-
ObjectFromTextGenerationModel
<SOURCE_PROMPT
,TARGET_PROMPT
,MODEL
>↳
ObjectFromTextStreamingModel
Implements
ObjectStreamingModel
<SOURCE_PROMPT
,MODEL
["settings"
]>
Accessors
modelInformation
• get
modelInformation(): ModelInformation
Returns
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
Implementation of
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
Name | Type |
---|---|
SOURCE_PROMPT | SOURCE_PROMPT |
TARGET_PROMPT | TARGET_PROMPT |
MODEL | extends TextStreamingModel <TARGET_PROMPT , TextGenerationModelSettings > |
Parameters
Name | Type |
---|---|
options | Object |
options.model | MODEL |
options.template | ObjectFromTextPromptTemplate <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
Name | Type |
---|---|
schema | Schema <unknown > & JsonSchemaProducer |
prompt | SOURCE_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
Name | Type |
---|---|
schema | Schema <unknown > & JsonSchemaProducer |
prompt | SOURCE_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
Name | Type |
---|---|
delta | unknown |
Returns
string
Implementation of
ObjectStreamingModel.extractObjectTextDelta
Defined in
packages/modelfusion/src/model-function/generate-object/ObjectFromTextStreamingModel.ts:63
getModelWithJsonOutput
▸ getModelWithJsonOutput(schema
): MODEL
Parameters
Name | Type |
---|---|
schema | Schema <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
Name | Type |
---|---|
accumulatedText | string |
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
Name | Type |
---|---|
additionalSettings | Partial <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