A class for generating embeddings using the Voyage AI API.

Hierarchy (view full)

Implements

Constructors

Properties

apiUrl: string
batchSize: number = 8

The maximum number of documents to embed in a single request. This is limited by the Voyage AI API to a maximum of 8.

modelName: string = "voyage-01"
basePath?: string = "https://api.voyageai.com/v1"
headers?: Record<string, string>

Methods

  • Generates embeddings for an array of texts.

    Parameters

    • texts: string[]

      An array of strings to generate embeddings for.

    Returns Promise<number[][]>

    A Promise that resolves to an array of embeddings.

  • Generates an embedding for a single text.

    Parameters

    • text: string

      A string to generate an embedding for.

    Returns Promise<number[]>

    A Promise that resolves to an array of numbers representing the embedding.

Generated using TypeDoc