Skip to main content

Module fallback_provider

Module fallback_provider 

Source
Expand description

Fallback provider – tries a primary LLM, falls back to secondary on transient failure.

Only falls back when the primary returns a transient error (as classified by PeError::is_transient()). Permanent errors propagate immediately.

§Example

use pe_core::fallback_provider::FallbackProvider;

let provider = FallbackProvider::new(openai_provider, anthropic_provider);
// Uses OpenAI by default; on transient failure, retries with Anthropic

Structs§

FallbackProvider
Wraps a primary and secondary LlmProvider. On transient failure from the primary, automatically tries the secondary.