pub struct MultiProviderConfig {
pub auto_routing: bool,
pub prefer_cost_efficient: bool,
pub max_retries_per_model: usize,
pub per_model_timeout: Option<Duration>,
pub circuit_breaker: CircuitBreakerConfig,
}Expand description
Configuration for MultiProvider behavior.
Controls auto-routing, cost preference, retry behavior, and circuit breaker settings.
Fields§
§auto_routing: boolEnable automatic complexity-based routing.
When true, the router classifies task complexity and selects
appropriate models before falling back to the incoming model.
Default: true
prefer_cost_efficient: boolPrefer cost-efficient models when routing.
When true and auto_routing is enabled, the router selects
cheaper models that still meet the complexity requirements.
Default: true
max_retries_per_model: usizeMaximum retries per model before giving up.
For each model in the candidate list, we retry this many times on retryable errors before moving to the next model.
Default: 1
per_model_timeout: Option<Duration>Per-model timeout for requests.
If set, wraps the request in a timeout. If None, uses the
provider’s default timeout.
Default: None
circuit_breaker: CircuitBreakerConfigCircuit breaker configuration for all providers.
Each registered provider gets its own circuit breaker instance with this configuration.
Default: CircuitBreakerConfig::default()
Implementations§
Source§impl MultiProviderConfig
impl MultiProviderConfig
Sourcepub fn with_auto_routing(self, enabled: bool) -> Self
pub fn with_auto_routing(self, enabled: bool) -> Self
Enable or disable automatic routing.
Sourcepub fn with_prefer_cost_efficient(self, enabled: bool) -> Self
pub fn with_prefer_cost_efficient(self, enabled: bool) -> Self
Enable or disable cost-efficient preference.
Sourcepub fn with_max_retries(self, retries: usize) -> Self
pub fn with_max_retries(self, retries: usize) -> Self
Set the maximum retries per model.
Sourcepub fn with_per_model_timeout(self, timeout: Duration) -> Self
pub fn with_per_model_timeout(self, timeout: Duration) -> Self
Set the per-model timeout.
Sourcepub fn with_circuit_breaker(self, config: CircuitBreakerConfig) -> Self
pub fn with_circuit_breaker(self, config: CircuitBreakerConfig) -> Self
Set the circuit breaker configuration.
Trait Implementations§
Source§impl Clone for MultiProviderConfig
impl Clone for MultiProviderConfig
Source§fn clone(&self) -> MultiProviderConfig
fn clone(&self) -> MultiProviderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more