Skip to main content

Function: extractWithFallback()

extractWithFallback<T>(params, providers): Promise<Result<T, AiError>>

Defined in: src/server/ai/orchestrator.ts:13

Try each provider in order, falling back on retryable failures (ADR 0026).

Pure with respect to vendor SDKs — providers are injected, so this is unit-testable without network access and the OpenAI→Anthropic order lives in one place (./index.ts). A non-retryable error (e.g. a 4xx caused by our own request) stops the chain immediately; falling back would just fail the same way. Every fallback is logged (provider + reason only, never the input).

Type Parameters

T

T

Parameters

params

ExtractParams<T>

providers

readonly AiProvider[]

Returns

Promise<Result<T, AiError>>