langchain.js
    Preparing search index...

    A class for generating embeddings using the Voyage AI API.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Constructor for the VoyageEmbeddings class.

      Parameters

      • Optionalfields: Partial<VoyageEmbeddingsParams> & {
            apiKey?: string;
            inputType?: string;
            verbose?: boolean;
        }

        An optional object with properties to configure the instance.

      Returns VoyageEmbeddings

    Properties

    apiUrl: string
    basePath?: string = "https://api.voyageai.com/v1"
    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.

    encodingFormat?: string

    The format of the output embeddings. Can be "float", "base64", or "ubinary".

    headers?: Record<string, string>
    inputType?: string

    Input type for the embeddings request.

    modelName: string = "voyage-01"
    outputDimension?: number

    The desired dimension of the output embeddings.

    outputDtype?: string

    The data type of the output embeddings. Can be "float" or "int8".

    truncation?: boolean

    Whether to truncate the input texts to the maximum length allowed by the model.

    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.