pub enum LlmError {
AuthError(String),
RateLimited {
retry_after: Option<Duration>,
},
ContextLengthExceeded {
used: u64,
limit: u64,
},
NetworkError(String),
InvalidResponse(String),
ModelNotFound(String),
ContentFiltered,
Timeout(Duration),
Other(Box<dyn Error + Send + Sync>),
}Expand description
LLM error types.
Comprehensive error types covering all failure modes when interacting with LLM providers.
Variants§
AuthError(String)
Authentication failed with the provider.
This typically indicates an invalid API key or expired credentials.
RateLimited
Rate limited by the provider.
The provider is limiting request rate. The caller should wait for the specified duration before retrying.
ContextLengthExceeded
Context length exceeded.
The input message count or token count exceeds the model’s context window.
NetworkError(String)
Generic network error.
Used when no provider features are enabled.
InvalidResponse(String)
Invalid response from provider.
The provider returned a response that could not be parsed or was malformed.
ModelNotFound(String)
Model not found.
The requested model name does not exist or is not available.
ContentFiltered
Content filtered by provider.
The provider refused to process the content due to policy violations.
Timeout(Duration)
Request timeout.
The provider did not respond within the specified time limit.
Other(Box<dyn Error + Send + Sync>)
Other error.
Catch-all for errors not covered by specific variants.
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()