langchain.js
    Preparing search index...

    Class for generating embeddings using the Gradient AI's API. Extends the Embeddings class and implements GradientEmbeddingsParams and

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    batchSize: number = 128
    gradientAccessKey?: string

    Gradient AI Access Token. Provide Access Token if you do not wish to automatically pull from env.

    model: any
    workspaceId?: string

    Gradient Workspace Id. Provide workspace id if you do not wish to automatically pull from env.

    Methods

    • Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the Gradient API to generate embeddings.

      Parameters

      • texts: string[]

        Array of documents to generate embeddings for.

      Returns Promise<number[][]>

      Promise that resolves to a 2D array of embeddings for each document.

    • Method to generate an embedding for a single document. Calls the embedDocuments method with the document as the input.

      Parameters

      • text: string

        Document to generate an embedding for.

      Returns Promise<number[]>

      Promise that resolves to an embedding for the document.

    • Method to set the model to use for generating embeddings.

      Returns Promise<void>

      the class' model value to that of the retrieved Embeddings Model.