pub enum LlmErrorKind {
Authentication,
QuotaExhausted,
RateLimited,
Unavailable,
InvalidRequest,
Other,
}Expand description
Semantic classification of an LLM provider error, assigned by the driver
at the provider boundary where the HTTP status and response body are still
available. Downstream consumers prefer this over re-parsing error strings;
LlmErrorKind::Other falls back to string classification
(classify_runtime_error_message) so untyped errors keep working.
Variants§
Authentication
Invalid or missing credentials, or access denied (401/403, bad API key).
QuotaExhausted
Provider account is out of credits/quota (billing). Non-transient: needs operator action, unlike a regular rate limit.
RateLimited
Transient rate limit (429).
Provider outage or unreachable (5xx, 529, network failure).
InvalidRequest
Provider rejected the request shape (4xx that is not auth/quota/429).
Other
Unclassified; downstream falls back to string classification.
Implementations§
Source§impl LlmErrorKind
impl LlmErrorKind
Sourcepub fn from_provider_status(status: u16, body: &str) -> Self
pub fn from_provider_status(status: u16, body: &str) -> Self
Classify a provider HTTP error from status code + response body.
Quota/billing patterns are checked before the status code because
providers surface exhausted billing under different statuses
(OpenAI: 429 insufficient_quota, Anthropic: 400 “credit balance is
too low”).
Sourcepub fn from_error_text(text: &str) -> Self
pub fn from_error_text(text: &str) -> Self
Keyword-based classification for drivers without an HTTP status at the error site (e.g. Bedrock SDK errors).
Trait Implementations§
Source§impl Clone for LlmErrorKind
impl Clone for LlmErrorKind
Source§fn clone(&self) -> LlmErrorKind
fn clone(&self) -> LlmErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LlmErrorKind
Source§impl Debug for LlmErrorKind
impl Debug for LlmErrorKind
Source§impl<'de> Deserialize<'de> for LlmErrorKind
impl<'de> Deserialize<'de> for LlmErrorKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for LlmErrorKind
Source§impl PartialEq for LlmErrorKind
impl PartialEq for LlmErrorKind
Source§fn eq(&self, other: &LlmErrorKind) -> bool
fn eq(&self, other: &LlmErrorKind) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for LlmErrorKind
impl Serialize for LlmErrorKind
impl StructuralPartialEq for LlmErrorKind
Auto Trait Implementations§
impl Freeze for LlmErrorKind
impl RefUnwindSafe for LlmErrorKind
impl Send for LlmErrorKind
impl Sync for LlmErrorKind
impl Unpin for LlmErrorKind
impl UnsafeUnpin for LlmErrorKind
impl UnwindSafe for LlmErrorKind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request