pub struct RetryingModel<M> { /* private fields */ }Expand description
Decorator that retries setup-time failures of an inner
CompletionModel using exponential backoff with optional jitter,
honouring Retry-After when the inner error provides it.
Implementations§
Source§impl<M> RetryingModel<M>
impl<M> RetryingModel<M>
Sourcepub fn new(inner: M) -> Self
pub fn new(inner: M) -> Self
Wrap inner with RetryConfig::default.
Sourcepub fn with_config(inner: M, config: RetryConfig) -> Self
pub fn with_config(inner: M, config: RetryConfig) -> Self
Wrap inner with explicit retry settings.
Sourcepub fn inner(&self) -> &M
pub fn inner(&self) -> &M
Borrow the wrapped model. Useful for tests that need to assert on the inner state without unwrapping.
Sourcepub fn into_inner(self) -> M
pub fn into_inner(self) -> M
Unwrap and return the inner model, dropping the retry layer.
Trait Implementations§
Source§impl<M> CompletionModel for RetryingModel<M>
impl<M> CompletionModel for RetryingModel<M>
Source§type Error = <M as CompletionModel>::Error
type Error = <M as CompletionModel>::Error
Error type for the model’s transport / setup failures.
Implement
crate::Retryable on it to make the model
composable with RetryingModel.Source§fn name(&self) -> &str
fn name(&self) -> &str
Adapter family name used in telemetry, e.g.
"anthropic" or
"azure-openai". Stable across model ids — changing model
name does not change this.Source§fn model(&self) -> &str
fn model(&self) -> &str
Model identifier this handle is bound to: Anthropic model id
(
"claude-sonnet-4-5"), Azure deployment name, etc. The
engine surfaces this in tracing and the JSON tracer envelope.Source§fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<StreamChunk, Self::Error>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<StreamChunk, Self::Error>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Open a streaming completion. Returns a stream of
Result<StreamChunk, Self::Error> so per-chunk transport
errors can be surfaced mid-stream. Setup-time failures (auth,
schema, transport open) return the outer Err.Auto Trait Implementations§
impl<M> Freeze for RetryingModel<M>where
M: Freeze,
impl<M> RefUnwindSafe for RetryingModel<M>where
M: RefUnwindSafe,
impl<M> Send for RetryingModel<M>where
M: Send,
impl<M> Sync for RetryingModel<M>where
M: Sync,
impl<M> Unpin for RetryingModel<M>where
M: Unpin,
impl<M> UnsafeUnpin for RetryingModel<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for RetryingModel<M>where
M: UnwindSafe,
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