#[non_exhaustive]pub enum InferenceExecutionError {
Provider(String),
RateLimited {
message: String,
retry_after: Option<Duration>,
},
Overloaded {
message: String,
retry_after: Option<Duration>,
},
Timeout(String),
StreamInterrupted {
cause: InterruptCause,
snapshot: Box<InterruptSnapshot>,
},
ContextOverflow(String),
InvalidRequest(String),
Unauthorized(String),
ModelNotFound(String),
ContentFiltered(String),
AllModelsUnavailable,
Cancelled,
}Expand description
Errors from LLM inference.
Variants split into three recoverability classes:
- Transient (retryable, count toward circuit breaker):
RateLimited,Overloaded,Timeout,Provider,StreamInterrupted. - Permanent (not retryable, do NOT count toward circuit breaker):
ContextOverflow,InvalidRequest,Unauthorized,ModelNotFound,ContentFiltered. - Fail-fast:
AllModelsUnavailable,Cancelled.
Use InferenceExecutionError::is_retryable and
InferenceExecutionError::counts_toward_circuit_breaker for policy
decisions instead of pattern-matching variants directly where possible.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Provider(String)
RateLimited
Fields
Overloaded
Timeout(String)
StreamInterrupted
ContextOverflow(String)
InvalidRequest(String)
ModelNotFound(String)
ContentFiltered(String)
Cancelled
Implementations§
Source§impl InferenceExecutionError
impl InferenceExecutionError
Sourcepub fn rate_limited(message: impl Into<String>) -> InferenceExecutionError
pub fn rate_limited(message: impl Into<String>) -> InferenceExecutionError
Short constructor for a rate-limit error with no Retry-After.
Sourcepub fn overloaded(message: impl Into<String>) -> InferenceExecutionError
pub fn overloaded(message: impl Into<String>) -> InferenceExecutionError
Short constructor for an overloaded error with no Retry-After.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether the retry subsystem should try this request again.
Transient errors return true; permanent and fail-fast errors
(including Cancelled) return false.
Sourcepub fn counts_toward_circuit_breaker(&self) -> bool
pub fn counts_toward_circuit_breaker(&self) -> bool
Whether this failure should increment the per-model circuit-breaker failure counter. Permanent errors (bad auth, bad schema, context overflow) must not trip the breaker — they would have failed with the same error on any model.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
If this error carries a Retry-After hint from the provider, return it.
Trait Implementations§
Source§impl Clone for InferenceExecutionError
impl Clone for InferenceExecutionError
Source§fn clone(&self) -> InferenceExecutionError
fn clone(&self) -> InferenceExecutionError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InferenceExecutionError
impl Debug for InferenceExecutionError
Source§impl Display for InferenceExecutionError
impl Display for InferenceExecutionError
Source§impl Error for InferenceExecutionError
impl Error for InferenceExecutionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<InferenceExecutionError> for AgentLoopError
impl From<InferenceExecutionError> for AgentLoopError
Source§fn from(e: InferenceExecutionError) -> AgentLoopError
fn from(e: InferenceExecutionError) -> AgentLoopError
Auto Trait Implementations§
impl Freeze for InferenceExecutionError
impl RefUnwindSafe for InferenceExecutionError
impl Send for InferenceExecutionError
impl Sync for InferenceExecutionError
impl Unpin for InferenceExecutionError
impl UnsafeUnpin for InferenceExecutionError
impl UnwindSafe for InferenceExecutionError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
fn into_option(self) -> Option<T>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.