Install and import from @langchain/baidu-qianfan instead.

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.