use serde::{Deserialize, Serialize};
use thiserror::Error;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ApiErrorResponse {
pub error: String,
}
#[derive(Error, Debug)]
pub enum OllamaError {
#[error("HTTP request failed: {0}")]
RequestError(#[from] reqwest::Error),
#[error("JSON parsing failed: {0}")]
JsonError(#[from] serde_json::Error),
#[error("URL parsing failed: {0}")]
UrlError(#[from] url::ParseError),
#[error("Ollama API error ({status}): {message}")]
ApiError {
status: u16,
message: String,
},
#[error("Invalid configuration: {0}")]
ConfigError(String),
#[error("Streaming error: {0}")]
StreamError(String),
#[error("Model not found: {0}")]
ModelNotFound(String),
#[error("Operation not supported: {0}")]
UnsupportedOperation(String),
}
pub type Result<T> = std::result::Result<T, OllamaError>;