#[derive(Debug, thiserror::Error)]
pub enum LlmError {
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("API error ({status}): {body}")]
Api { status: u16, body: String },
#[error("Deserialize error: {0}")]
Deserialize(String),
#[error("Stream interrupted: {0}")]
StreamInterrupted(String),
#[error("Request build error: {0}")]
RequestBuild(String),
}
impl From<serde_json::Error> for LlmError {
fn from(e: serde_json::Error) -> Self {
LlmError::Deserialize(e.to_string())
}
}