pub struct RetryMiddleware { /* private fields */ }Expand description
Retries transient LLM errors with exponential backoff and jitter.
max_attempts: total attempts including the first call (minimum 1).initial_interval: base delay before the first retry; doubles each attempt.- Jitter: up to 25% of the current interval, added randomly.
Implementations§
Trait Implementations§
Source§impl ProviderMiddleware for RetryMiddleware
impl ProviderMiddleware for RetryMiddleware
Source§fn wrap_complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSchema],
next: &'life3 dyn LlmProvider,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, PeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn wrap_complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSchema],
next: &'life3 dyn LlmProvider,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, PeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Wrap a completion call. Call
next.complete(messages, tools).await
to forward to the next layer (or the base provider).Auto Trait Implementations§
impl Freeze for RetryMiddleware
impl RefUnwindSafe for RetryMiddleware
impl Send for RetryMiddleware
impl Sync for RetryMiddleware
impl Unpin for RetryMiddleware
impl UnsafeUnpin for RetryMiddleware
impl UnwindSafe for RetryMiddleware
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