Function: createRetryWithRateLimit()
function createRetryWithRateLimit(rateLimiter, config?): <T>(fn, estimatedTokens?) => Promise<T>;
Defined in: rate-limit/retry.ts:199
Create a retry wrapper that also integrates with rate limiting
Parameters
| Parameter | Type | Description |
|---|---|---|
rateLimiter | RateLimiter | Rate limiter instance |
config | RetryConfig | Retry configuration |
Returns
Function wrapper with retry and rate limiting
<T>(fn, estimatedTokens?) => Promise<T>
Example
const limiter = createRateLimiter({ requestsPerMinute: 60 });
const retryWithLimit = createRetryWithRateLimit(limiter, { maxRetries: 3 });
const result = await retryWithLimit(
() => provider.chat(messages, options),
1000 // estimated tokens
);