pub enum LlmError {
Show 18 variants
Http(Error),
Json(Error),
RateLimited,
Unavailable,
EmptyResponse {
provider: String,
},
SseParse(String),
EmbedUnsupported {
provider: String,
},
ModelLoad(String),
Inference(String),
NoRoute,
NoProviders,
StructuredParse(String),
TranscriptionFailed(String),
ContextLengthExceeded,
Timeout,
BetaHeaderRejected {
header: String,
},
InvalidInput {
provider: String,
message: String,
},
Other(String),
}Variants§
Http(Error)
Json(Error)
RateLimited
EmptyResponse
SseParse(String)
EmbedUnsupported
ModelLoad(String)
Inference(String)
NoRoute
NoProviders
StructuredParse(String)
TranscriptionFailed(String)
ContextLengthExceeded
Timeout
BetaHeaderRejected
A beta header sent in the request was rejected by the API (e.g. compact-2026-01-12
deprecated or not yet available). The provider has already disabled the feature
internally; the caller should retry without it.
InvalidInput
The input itself is invalid (HTTP 400). Retrying with the same input on another provider will not help — the router should break the fallback loop immediately.
Other(String)
Implementations§
Source§impl LlmError
impl LlmError
Sourcepub fn is_context_length_error(&self) -> bool
pub fn is_context_length_error(&self) -> bool
Returns true if this error indicates the context/prompt is too long for the model.
Sourcepub fn is_beta_header_rejected(&self) -> bool
pub fn is_beta_header_rejected(&self) -> bool
Returns true if this error indicates that a beta header was rejected by the API.
Sourcepub fn is_invalid_input(&self) -> bool
pub fn is_invalid_input(&self) -> bool
Returns true if this error indicates that the input itself is invalid (HTTP 400).
Callers (e.g. the router fallback loop) should not retry with a different provider when this is true — the same input will fail there too.
pub fn is_rate_limited(&self) -> bool
Trait Implementations§
Source§impl Error for LlmError
impl Error for LlmError
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()
Auto Trait Implementations§
impl Freeze for LlmError
impl !RefUnwindSafe for LlmError
impl Send for LlmError
impl Sync for LlmError
impl Unpin for LlmError
impl UnsafeUnpin for LlmError
impl !UnwindSafe for LlmError
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> 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> 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.