Skip to main content

RetryingModel

Struct RetryingModel 

Source
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>

Source

pub fn new(inner: M) -> Self

Wrap inner with RetryConfig::default.

Source

pub fn with_config(inner: M, config: RetryConfig) -> Self

Wrap inner with explicit retry settings.

Source

pub fn inner(&self) -> &M

Borrow the wrapped model. Useful for tests that need to assert on the inner state without unwrapping.

Source

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>

Source§

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

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

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,

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.