Skip to main content

Class: OpenAIEmbedding

Hierarchy

Constructors

constructor

new OpenAIEmbedding(init?)

Parameters

NameType
init?Partial<OpenAIEmbedding> & { azure?: AzureOpenAIConfig }

Overrides

BaseEmbedding.constructor

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:30

Properties

additionalSessionOptions

Optional additionalSessionOptions: Omit<Partial<ClientOptions>, "apiKey" | "timeout" | "maxRetries">

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:23


apiKey

Optional apiKey: string = undefined

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:20


maxRetries

maxRetries: number

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:21


model

model: string

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:17


session

session: OpenAISession

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:28


timeout

Optional timeout: number

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:22

Methods

getOpenAIEmbedding

Private getOpenAIEmbedding(input): Promise<number[]>

Parameters

NameType
inputstring

Returns

Promise<number[]>

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:76


getQueryEmbedding

getQueryEmbedding(query): Promise<number[]>

Parameters

NameType
querystring

Returns

Promise<number[]>

Overrides

BaseEmbedding.getQueryEmbedding

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:89


getTextEmbedding

getTextEmbedding(text): Promise<number[]>

Parameters

NameType
textstring

Returns

Promise<number[]>

Overrides

BaseEmbedding.getTextEmbedding

Defined in

packages/core/src/embeddings/OpenAIEmbedding.ts:85


similarity

similarity(embedding1, embedding2, mode?): number

Parameters

NameTypeDefault value
embedding1number[]undefined
embedding2number[]undefined
modeSimilarityTypeSimilarityType.DEFAULT

Returns

number

Inherited from

BaseEmbedding.similarity

Defined in

packages/core/src/embeddings/types.ts:14