interface BaiduQianfanEmbeddingsParams {
    batchSize?: number;
    maxConcurrency?: number;
    maxRetries?: number;
    modelName:
        | "Embedding-V1"
        | "bge-large-zh"
        | "bge-large-en"
        | "tao-8k";
    onFailedAttempt?: FailedAttemptHandler;
    stripNewLines?: boolean;
    timeout?: number;
}

Hierarchy

  • EmbeddingsParams
    • BaiduQianfanEmbeddingsParams

Implemented by

Properties

batchSize?: number

The maximum number of characters allowed for embedding in a single request varies by model:

  • Embedding-V1 model: up to 1000 characters
  • bge-large-zh model: up to 2000 characters
  • bge-large-en model: up to 2000 characters
  • tao-8k model: up to 28000 characters

Note: These limits are model-specific and should be adhered to for optimal performance.

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:
    | "Embedding-V1"
    | "bge-large-zh"
    | "bge-large-en"
    | "tao-8k"

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.

stripNewLines?: boolean

Whether to strip new lines from the input text.

timeout?: number

Timeout to use when making requests to BaiduQianfan.