pub struct FallbackConfig {
pub enabled: bool,
pub models: Vec<String>,
pub endpoints: Vec<String>,
pub on_rate_limit: FallbackBehavior,
pub on_timeout: FallbackBehavior,
pub on_all_failed: OnAllFailedBehavior,
pub max_retries: usize,
pub initial_retry_delay_ms: u64,
pub max_retry_delay_ms: u64,
pub retry_multiplier: f32,
}Expand description
Fallback configuration for error recovery.
Fields§
§enabled: boolWhether fallback is enabled.
models: Vec<String>Fallback models in priority order.
endpoints: Vec<String>Fallback endpoints in priority order.
on_rate_limit: FallbackBehaviorBehavior on rate limit error (429).
on_timeout: FallbackBehaviorBehavior on timeout error.
on_all_failed: OnAllFailedBehaviorBehavior when all attempts fail.
max_retries: usizeMaximum retry attempts.
initial_retry_delay_ms: u64Initial retry delay in milliseconds.
max_retry_delay_ms: u64Maximum retry delay in milliseconds.
retry_multiplier: f32Retry delay multiplier (exponential backoff).
Implementations§
Source§impl FallbackConfig
impl FallbackConfig
Sourcepub fn with_models(self, models: Vec<String>) -> Self
pub fn with_models(self, models: Vec<String>) -> Self
Set fallback models.
Sourcepub fn with_endpoints(self, endpoints: Vec<String>) -> Self
pub fn with_endpoints(self, endpoints: Vec<String>) -> Self
Set fallback endpoints.
Sourcepub fn with_on_rate_limit(self, behavior: FallbackBehavior) -> Self
pub fn with_on_rate_limit(self, behavior: FallbackBehavior) -> Self
Set behavior on rate limit.
Sourcepub fn with_on_timeout(self, behavior: FallbackBehavior) -> Self
pub fn with_on_timeout(self, behavior: FallbackBehavior) -> Self
Set behavior on timeout.
Sourcepub fn with_on_all_failed(self, behavior: OnAllFailedBehavior) -> Self
pub fn with_on_all_failed(self, behavior: OnAllFailedBehavior) -> Self
Set behavior when all attempts fail.
Sourcepub fn with_max_retries(self, max: usize) -> Self
pub fn with_max_retries(self, max: usize) -> Self
Set maximum retries.
Sourcepub fn calculate_retry_delay(&self, attempt: usize) -> Duration
pub fn calculate_retry_delay(&self, attempt: usize) -> Duration
Calculate retry delay with exponential backoff.
Trait Implementations§
Source§impl Clone for FallbackConfig
impl Clone for FallbackConfig
Source§fn clone(&self) -> FallbackConfig
fn clone(&self) -> FallbackConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FallbackConfig
impl Debug for FallbackConfig
Source§impl Default for FallbackConfig
impl Default for FallbackConfig
Source§impl<'de> Deserialize<'de> for FallbackConfig
impl<'de> Deserialize<'de> for FallbackConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<FallbackConfig> for FallbackConfig
impl From<FallbackConfig> for FallbackConfig
Source§fn from(config: ConfigFallbackConfig) -> Self
fn from(config: ConfigFallbackConfig) -> Self
Converts to this type from the input type.
Source§impl Merge for FallbackConfig
impl Merge for FallbackConfig
Source§fn merge(&mut self, other: &Self, strategy: MergeStrategy)
fn merge(&mut self, other: &Self, strategy: MergeStrategy)
Merge another configuration into this one.
Auto Trait Implementations§
impl Freeze for FallbackConfig
impl RefUnwindSafe for FallbackConfig
impl Send for FallbackConfig
impl Sync for FallbackConfig
impl Unpin for FallbackConfig
impl UnsafeUnpin for FallbackConfig
impl UnwindSafe for FallbackConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more