Interface that extends EmbeddingsParams and defines additional parameters specific to the ZhipuAIEmbeddingsParams class.

Hierarchy

  • Embeddings
    • ZhipuAIEmbeddings

Implements

Constructors

Properties

apiKey?: string

ZhipuAI API key to use

caller: AsyncCaller

The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.

modelName: undefined | "embedding-2" = "embedding-2"

Model Name to use

stripNewLines: boolean = true

Whether to strip new lines from the input text.

Methods

  • Method that takes an array of documents as input and returns a promise that resolves to a 2D array of embeddings for each document. It calls the embedQuery method for each document in the array.

    Parameters

    • documents: string[]

      Array of documents for which to generate embeddings.

    Returns Promise<number[][]>

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

  • Method to generate an embedding for a single document. Calls the embeddingWithRetry 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.