1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum LlmError {
8 #[error("Configuration error: {0}")]
9 ConfigError(String),
10
11 #[error("Network connection failed: {0}")]
12 ConnectionError(String),
13
14 #[error("Authentication failed, please check your API key configuration")]
15 AuthenticationError,
16
17 #[error("Rate limit exceeded, please retry later")]
18 RateLimitError { retry_after: Option<u64> },
19
20 #[error("Model not available: {model}")]
21 ModelNotFound { model: String },
22
23 #[error("Server error ({status}): {message}")]
24 ServerError { status: u16, message: String },
25
26 #[error("Response format error: {0}")]
27 ParseError(String),
28
29 #[error(transparent)]
30 OpenAiError(#[from] async_openai::error::OpenAIError),
31}