Skip to main content

Class: AbstractOpenAITextEmbeddingModel<SETTINGS>

Abstract text embedding model that calls an API that is compatible with the OpenAI embedding API.

See

https://platform.openai.com/docs/api-reference/embeddings

Type parameters

NameType
SETTINGSextends AbstractOpenAITextEmbeddingModelSettings

Hierarchy

Accessors

maxValuesPerCall

get maxValuesPerCall(): number

Returns

number

Defined in

packages/modelfusion/src/model-provider/openai/AbstractOpenAITextEmbeddingModel.ts:38


modelInformation

get modelInformation(): ModelInformation

Returns

ModelInformation

Inherited from

AbstractModel.modelInformation

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:17


settingsForEvent

get settingsForEvent(): Partial<SETTINGS>

Returns

Partial<SETTINGS>

Inherited from

AbstractModel.settingsForEvent

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:24

Constructors

constructor

new AbstractOpenAITextEmbeddingModel<SETTINGS>(settings): AbstractOpenAITextEmbeddingModel<SETTINGS>

Type parameters

NameType
SETTINGSextends AbstractOpenAITextEmbeddingModelSettings

Parameters

NameType
settingsSETTINGS

Returns

AbstractOpenAITextEmbeddingModel<SETTINGS>

Overrides

AbstractModel&lt;SETTINGS&gt;.constructor

Defined in

packages/modelfusion/src/model-provider/openai/AbstractOpenAITextEmbeddingModel.ts:34

Methods

callAPI

callAPI(texts, callOptions): Promise<{ data: { embedding: number[] ; index: number ; object: "embedding" }[] ; model: string ; object: "list" ; usage?: { prompt_tokens: number ; total_tokens: number } }>

Parameters

NameType
textsstring[]
callOptionsFunctionCallOptions

Returns

Promise<{ data: { embedding: number[] ; index: number ; object: "embedding" }[] ; model: string ; object: "list" ; usage?: { prompt_tokens: number ; total_tokens: number } }>

Defined in

packages/modelfusion/src/model-provider/openai/AbstractOpenAITextEmbeddingModel.ts:44


doEmbedValues

doEmbedValues(texts, callOptions): Promise<{ embeddings: number[][] ; rawResponse: { data: { embedding: number[] ; index: number ; object: "embedding" }[] ; model: string ; object: "list" ; usage?: { prompt_tokens: number ; total_tokens: number } } }>

Parameters

NameType
textsstring[]
callOptionsFunctionCallOptions

Returns

Promise<{ embeddings: number[][] ; rawResponse: { data: { embedding: number[] ; index: number ; object: "embedding" }[] ; model: string ; object: "list" ; usage?: { prompt_tokens: number ; total_tokens: number } } }>

Defined in

packages/modelfusion/src/model-provider/openai/AbstractOpenAITextEmbeddingModel.ts:80


withSettings

withSettings(additionalSettings): this

Parameters

NameType
additionalSettingsPartial<SETTINGS>

Returns

this

Inherited from

AbstractModel.withSettings

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:26

Properties

isParallelizable

Readonly isParallelizable: true

Defined in

packages/modelfusion/src/model-provider/openai/AbstractOpenAITextEmbeddingModel.ts:42


modelName

Readonly Abstract modelName: null | string

Inherited from

AbstractModel.modelName

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:14


provider

Readonly Abstract provider: string

Inherited from

AbstractModel.provider

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:13


settings

Readonly settings: SETTINGS

Inherited from

AbstractModel.settings

Defined in

packages/modelfusion/src/model-function/AbstractModel.ts:7