Class for generating embeddings using the Tencent Hunyuan API.

Hierarchy

  • TencentHunyuanEmbeddings
    • TencentHunyuanEmbeddings

Constructors

Properties

host: string = "hunyuan.tencentcloudapi.com"

Tencent Cloud API Host.

"hunyuan.tencentcloudapi.com"
sign: sign
tencentSecretId?: string

SecretID to use when making requests, can be obtained from https://console.cloud.tencent.com/cam/capi. Defaults to the value of TENCENT_SECRET_ID environment variable.

tencentSecretKey?: string

Secret key to use when making requests, can be obtained from https://console.cloud.tencent.com/cam/capi. Defaults to the value of TENCENT_SECRET_KEY environment variable.

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.

""