UNPKG

ai-utils.js

Version:

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

8 lines (7 loc) 605 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.callWithRetryAndThrottle = void 0; const retryWithExponentialBackoff_js_1 = require("./retryWithExponentialBackoff.cjs"); const throttleUnlimitedConcurrency_js_1 = require("./throttleUnlimitedConcurrency.cjs"); const callWithRetryAndThrottle = async ({ retry = (0, retryWithExponentialBackoff_js_1.retryWithExponentialBackoff)(), throttle = (0, throttleUnlimitedConcurrency_js_1.throttleUnlimitedConcurrency)(), call, }) => retry(async () => throttle(call)); exports.callWithRetryAndThrottle = callWithRetryAndThrottle;