Skip to content

VoyageAIEmbedding

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:16

VoyageAIEmbedding is an alias for VoyageAI that implements the BaseEmbedding interface.

  • BaseEmbedding

VoyageAIEmbedding<Options>(nodes, options?): Promise

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:16

VoyageAIEmbedding is an alias for VoyageAI that implements the BaseEmbedding interface.

Options extends Record<string, unknown>

BaseNode<Metadata>[]

Options

Promise

new VoyageAIEmbedding(init?): VoyageAIEmbedding

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:68

Partial<VoyageAIEmbedding>

VoyageAIEmbedding

BaseEmbedding.constructor

model: string

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:22

VoyageAI model to use

"voyage-3"

https://docs.voyageai.com/docs/embeddings


apiKey: string

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:30

VoyageAI API token

https://docs.voyageai.com/docs/api-key-and-installation If not provided, it will try to get the token from the environment variable VOYAGE_API_KEY


maxRetries: number

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:36

Maximum number of retries

5

timeout: number

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:42

Timeout in seconds

60

truncation: boolean

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:48

Whether to truncate the input texts to fit within the context length. Defaults to true. If true, over-length input texts will be truncated to fit within the context length, before vectorized by the embedding model. If false, an error will be raised if any given text exceeds the context length.


useInputTypes: undefined | "query" | "document" | "both"

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:61

VoyageAI supports document and query as input types, or it can be left undefined. Using an input type prepends the input with a prompt before embedding. Example from their docs: using “query” adds “Represent the query for retrieving supporting documents:” VoyageAI says these types improve performance, but it will add to token usage. Embeddings with input types are compatible with those that don’t use them. Setting this to query will use the query input type for getQueryEmbedding(s). Setting this to document will use the document input type for getTextEmbedding(s). Setting this to both will do both of the above. By default, this is undefined, which means no input types are used.

https://docs.voyageai.com/docs/embeddings

undefined

client: VoyageAIClient

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:66

VoyageAI client

getTextEmbedding(text): Promise<number[]>

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:82

string

Promise<number[]>

BaseEmbedding.getTextEmbedding


getQueryEmbedding(query): Promise<null | number[]>

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:87

MessageContentDetail

Promise<null | number[]>

BaseEmbedding.getQueryEmbedding


getTextEmbeddings(texts): Promise<number[][]>

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:99

string[]

Promise<number[][]>

BaseEmbedding.getTextEmbeddings


getQueryEmbeddings(queries): Promise<number[][]>

Defined in: .build/typescript/packages/providers/voyage-ai/src/embedding.ts:103

string[]

Promise<number[][]>