interface AlibabaTongyiEmbeddingsParams {
    batchSize?: number;
    maxConcurrency?: number;
    maxRetries?: number;
    modelName: "text-embedding-v2";
    onFailedAttempt?: FailedAttemptHandler;
    parameters?: {
        text_type?: "document" | "query";
    };
    stripNewLines?: boolean;
    timeout?: number;
}

Hierarchy

  • EmbeddingsParams
    • AlibabaTongyiEmbeddingsParams

Implemented by

Properties

batchSize?: number

The maximum number of documents to embed in a single request. This is limited by the AlibabaTongyi API to a maximum of 2048.

maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

modelName: "text-embedding-v2"

Model name to use

onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.

parameters?: {
    text_type?: "document" | "query";
}

Type declaration

  • Optionaltext_type?: "document" | "query"

    取值:query 或者 document,默认值为 document 说明:文本转换为向量后可以应用于检索、聚类、分类等下游任务, 对检索这类非对称任务为了达到更好的检索效果建议区分查询文本(query)和 底库文本(document)类型, 聚类、分类等对称任务可以不用特殊指定, 采用系统默认值"document"即可

stripNewLines?: boolean

Whether to strip new lines from the input text.

timeout?: number

Timeout to use when making requests to AlibabaTongyi.