UNPKG

ai-utils.js

Version:

Build AI applications, chatbots, and agents with JavaScript and TypeScript.

4 lines (3 loc) 340 B
import { retryWithExponentialBackoff } from "./retryWithExponentialBackoff.js"; import { throttleUnlimitedConcurrency } from "./throttleUnlimitedConcurrency.js"; export const callWithRetryAndThrottle = async ({ retry = retryWithExponentialBackoff(), throttle = throttleUnlimitedConcurrency(), call, }) => retry(async () => throttle(call));