use thiserror::Error;
pub type LLMResult<T> = Result<T, LLMError>;
#[derive(Error, Debug)]
pub enum LLMError {
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
#[error("Shape mismatch: expected {expected}, got {actual}")]
ShapeMismatch {
expected: String,
actual: String,
},
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Generation error: {0}")]
GenerationError(String),
#[error("Model loading error: {0}")]
LoadError(String),
#[error("Core error: {0}")]
CoreError(#[from] axonml_core::Error),
#[error("IO error: {0}")]
IoError(String),
#[error("Network error: {0}")]
NetworkError(String),
#[error("Parse error: {0}")]
ParseError(String),
#[error("Model not found: {0}")]
ModelNotFound(String),
#[error("Weight not found: {0}")]
WeightNotFound(String),
#[error("Unsupported format: {0}")]
UnsupportedFormat(String),
#[error("Tensor error: {0}")]
TensorError(String),
#[error("Hub error: {0}")]
HubError(String),
}
impl From<crate::hub::HubError> for LLMError {
fn from(e: crate::hub::HubError) -> Self {
LLMError::HubError(e.to_string())
}
}