#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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§
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
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
Mutably borrows from an owned value. Read more