pub struct ResilientProvider<P: LlmProvider> { /* private fields */ }Expand description
Resilient LLM provider that wraps any provider with circuit breaker resilience
Implementations§
Source§impl<P: LlmProvider> ResilientProvider<P>
impl<P: LlmProvider> ResilientProvider<P>
Sourcepub fn new(provider: P, config: LlmCircuitConfig) -> Self
pub fn new(provider: P, config: LlmCircuitConfig) -> Self
Create a resilient wrapper around an LLM provider
Sourcepub async fn circuit_state(&self) -> CircuitState
pub async fn circuit_state(&self) -> CircuitState
Get current circuit state
Trait Implementations§
Source§impl<P: Debug + LlmProvider> Debug for ResilientProvider<P>
impl<P: Debug + LlmProvider> Debug for ResilientProvider<P>
Source§impl<P: LlmProvider + 'static> LlmProvider for ResilientProvider<P>
impl<P: LlmProvider + 'static> LlmProvider for ResilientProvider<P>
Source§fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the provider is available
Auto Trait Implementations§
impl<P> !Freeze for ResilientProvider<P>
impl<P> !RefUnwindSafe for ResilientProvider<P>
impl<P> Send for ResilientProvider<P>
impl<P> Sync for ResilientProvider<P>
impl<P> Unpin for ResilientProvider<P>
impl<P> !UnwindSafe for ResilientProvider<P>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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