pub enum RetryStrategy {
ExponentialBackoff {
base_delay: Duration,
max_delay: Duration,
max_attempts: u32,
},
WaitAndRetry {
wait: Duration,
},
ReduceContext,
NoRetry,
}Expand description
Strategy for retrying failed LLM operations.
Each error type maps to an appropriate retry strategy based on whether the error is transient (retry) or permanent (no retry).
Variants§
ExponentialBackoff
Retry with exponential backoff (for transient errors).
Fields
WaitAndRetry
Wait for a specific duration then retry once (for rate limits).
ReduceContext
Do not retry, but caller should reduce context size and try again.
NoRetry
Do not retry at all (permanent error).
Implementations§
Source§impl RetryStrategy
impl RetryStrategy
Sourcepub fn network_backoff() -> Self
pub fn network_backoff() -> Self
Create a standard exponential backoff strategy for network errors.
Sourcepub fn server_backoff() -> Self
pub fn server_backoff() -> Self
Create a standard exponential backoff strategy for server errors.
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
Check if this strategy allows retrying.
Trait Implementations§
Source§impl Clone for RetryStrategy
impl Clone for RetryStrategy
Source§fn clone(&self) -> RetryStrategy
fn clone(&self) -> RetryStrategy
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 RetryStrategy
impl Debug for RetryStrategy
Source§impl PartialEq for RetryStrategy
impl PartialEq for RetryStrategy
impl StructuralPartialEq for RetryStrategy
Auto Trait Implementations§
impl Freeze for RetryStrategy
impl RefUnwindSafe for RetryStrategy
impl Send for RetryStrategy
impl Sync for RetryStrategy
impl Unpin for RetryStrategy
impl UnsafeUnpin for RetryStrategy
impl UnwindSafe for RetryStrategy
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