Class: AsyncCaller
base_language.internal.AsyncCaller
A class that can be used to make async calls with concurrency and retry logic.
This is useful for making calls to any kind of "expensive" external resource, be it because it's rate-limited, subject to network issues, etc.
Concurrent calls are limited by the maxConcurrency
parameter, which defaults
to Infinity
. This means that by default, all calls will be made in parallel.
Retries are limited by the maxRetries
parameter, which defaults to 6. This
means that by default, each call will be retried up to 6 times, with an
exponential backoff between each attempt.
Constructors
constructor
• new AsyncCaller(params
)
Parameters
Name | Type |
---|---|
params | AsyncCallerParams |
Defined in
langchain/src/util/async_caller.ts:37
Properties
maxConcurrency
• Protected
maxConcurrency: undefined
| number
Defined in
langchain/src/util/async_caller.ts:31
maxRetries
• Protected
maxRetries: undefined
| number
Defined in
langchain/src/util/async_caller.ts:33
queue
• Protected
queue: default
<default
, QueueAddOptions
>
Defined in
langchain/src/util/async_caller.ts:35
Methods
call
▸ call<A
, T
>(callable
, ...args
): Promise
<ReturnType
<T
>>
Type parameters
Name | Type |
---|---|
A | extends any [] |
T | extends (...args : A ) => Promise <any > |
Parameters
Name | Type |
---|---|
callable | T |
...args | Parameters <T > |
Returns
Promise
<ReturnType
<T
>>
Defined in
langchain/src/util/async_caller.ts:45