Class: ObjectFromTextGenerationModel<SOURCE_PROMPT, TARGET_PROMPT, MODEL>
Type parameters
Name | Type |
---|---|
SOURCE_PROMPT | SOURCE_PROMPT |
TARGET_PROMPT | TARGET_PROMPT |
MODEL | extends TextGenerationModel <TARGET_PROMPT , TextGenerationModelSettings > |
Hierarchy
-
ObjectFromTextGenerationModel
Implements
ObjectGenerationModel
<SOURCE_PROMPT
,MODEL
["settings"
]>
Accessors
modelInformation
• get
modelInformation(): ModelInformation
Returns
Implementation of
ObjectGenerationModel.modelInformation
Defined in
packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:36
settings
• get
settings(): TextGenerationModelSettings
Returns
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
Name | Type |
---|---|
SOURCE_PROMPT | SOURCE_PROMPT |
TARGET_PROMPT | TARGET_PROMPT |
MODEL | extends TextGenerationModel <TARGET_PROMPT , TextGenerationModelSettings > |
Parameters
Name | Type |
---|---|
«destructured» | Object |
› model | MODEL |
› template | ObjectFromTextPromptTemplate <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
Name | Type |
---|---|
schema | Schema <unknown > & JsonSchemaProducer |
prompt | SOURCE_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
Name | Type |
---|---|
schema | Schema <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
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
ObjectGenerationModel.withSettings
Defined in
packages/modelfusion/src/model-function/generate-object/ObjectFromTextGenerationModel.ts:85