@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
37 lines • 1.71 kB
TypeScript
/**
* AI SDK Retry Configuration
*
* Resolves the `maxRetries` value passed to Vercel AI SDK calls per operation
* type. Different operations have different sensitivity profiles:
*
* embeddings: batch/background work, resilience over latency, higher retries
* chat: interactive request/response, fail fast for responsiveness
* tool_loop: multi-step agentic loops, moderate retries per step
* wrap_up: final summary call after a tool loop, fail fast (we already
* have a partial answer to fall back to)
*
* Defaults can be overridden globally or per-operation via env vars:
*
* DOT_AI_AI_MAX_RETRIES global default for all operations
* DOT_AI_AI_MAX_RETRIES_EMBEDDINGS embeddings only
* DOT_AI_AI_MAX_RETRIES_CHAT single-turn chat only
* DOT_AI_AI_MAX_RETRIES_TOOL_LOOP agentic tool loop only
* DOT_AI_AI_MAX_RETRIES_WRAP_UP wrap-up call after the tool loop
*
* Per-operation env vars take precedence over the global one. Invalid values
* (non-integer, negative, NaN) are ignored and the next fallback is used.
*/
export type AIOperation = 'embeddings' | 'chat' | 'tool_loop' | 'wrap_up';
/**
* Resolve `maxRetries` for the given operation. Precedence:
* 1. per-operation env var (if set and valid)
* 2. global env var (if set and valid)
* 3. per-operation default
*/
export declare function getMaxRetries(operation: AIOperation, env?: NodeJS.ProcessEnv): number;
/**
* Exported for tests that want to assert the configured defaults without
* setting env vars.
*/
export declare const __defaults: Readonly<Record<AIOperation, number>>;
//# sourceMappingURL=ai-retry-config.d.ts.map