#[non_exhaustive]pub enum LlmError {
Show 13 variants
InvalidRequest(String),
Auth(String),
RateLimited {
retry_after: Option<Duration>,
message: String,
},
Provider {
status: u16,
message: String,
},
Transport(String),
Timeout,
Serialization(String),
Stream(String),
BudgetExceeded(String),
Tool {
tool: String,
message: String,
},
Unsupported(String),
AllProvidersFailed(Vec<LlmError>),
Other(String),
}Expand description
The single error type returned by every llmkit operation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidRequest(String)
Request rejected before sending (missing model, empty messages, …).
Auth(String)
Authentication failed (missing or invalid API key).
RateLimited
Provider returned HTTP 429.
Fields
Provider
Provider returned a non-success status with a body.
Transport(String)
Network / transport failure.
Timeout
Request exceeded the configured timeout.
Serialization(String)
Failed to (de)serialize a body.
Stream(String)
Error while parsing or driving a streaming response.
BudgetExceeded(String)
A configured budget (e.g. session cost cap) was exceeded.
Tool
A tool invocation failed during execution.
Unsupported(String)
Capability not supported by this provider.
AllProvidersFailed(Vec<LlmError>)
Every provider in a fallback chain failed.
Other(String)
Catch-all.
Implementations§
Source§impl LlmError
impl LlmError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether retrying might succeed. Used by the retry layer.
Sourcepub fn invalid(msg: impl Display) -> Self
pub fn invalid(msg: impl Display) -> Self
Construct an LlmError::InvalidRequest.
Sourcepub fn serde(msg: impl Display) -> Self
pub fn serde(msg: impl Display) -> Self
Construct an LlmError::Serialization.
Trait Implementations§
Source§impl Error for LlmError
impl Error for LlmError
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()