pub struct FallbackChain { /* private fields */ }Expand description
Fallback chain manager.
Implementations§
Source§impl FallbackChain
impl FallbackChain
Sourcepub fn new(config: FallbackConfig) -> Self
pub fn new(config: FallbackConfig) -> Self
Create a new fallback chain with the given configuration.
Sourcepub fn config(&self) -> &FallbackConfig
pub fn config(&self) -> &FallbackConfig
Get the configuration.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if fallback is enabled.
Sourcepub fn behavior_for_error(&self, error: &LlmError) -> FallbackBehavior
pub fn behavior_for_error(&self, error: &LlmError) -> FallbackBehavior
Determine the appropriate behavior for an error.
Sourcepub fn should_fallback(&self, error: &LlmError) -> bool
pub fn should_fallback(&self, error: &LlmError) -> bool
Check if an error should trigger fallback.
Sourcepub fn should_retry(&self, error: &LlmError) -> bool
pub fn should_retry(&self, error: &LlmError) -> bool
Check if an error should trigger retry.
Sourcepub fn next_model(&self, current: &str) -> Option<String>
pub fn next_model(&self, current: &str) -> Option<String>
Get the next fallback model.
Sourcepub fn next_endpoint(&self, current: &str) -> Option<String>
pub fn next_endpoint(&self, current: &str) -> Option<String>
Get the next fallback endpoint.
Trait Implementations§
Source§impl Clone for FallbackChain
impl Clone for FallbackChain
Source§fn clone(&self) -> FallbackChain
fn clone(&self) -> FallbackChain
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 moreAuto Trait Implementations§
impl Freeze for FallbackChain
impl RefUnwindSafe for FallbackChain
impl Send for FallbackChain
impl Sync for FallbackChain
impl Unpin for FallbackChain
impl UnsafeUnpin for FallbackChain
impl UnwindSafe for FallbackChain
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