Skip to main content

axonml_llm/
error.rs

1//! Error types for the LLM module.
2
3use thiserror::Error;
4
5/// Result type for LLM operations.
6pub type LLMResult<T> = Result<T, LLMError>;
7
8/// Error types for LLM operations.
9#[derive(Error, Debug)]
10pub enum LLMError {
11    /// Invalid configuration
12    #[error("Invalid configuration: {0}")]
13    InvalidConfig(String),
14
15    /// Shape mismatch
16    #[error("Shape mismatch: expected {expected}, got {actual}")]
17    ShapeMismatch {
18        /// Expected shape
19        expected: String,
20        /// Actual shape
21        actual: String,
22    },
23
24    /// Invalid input
25    #[error("Invalid input: {0}")]
26    InvalidInput(String),
27
28    /// Generation error
29    #[error("Generation error: {0}")]
30    GenerationError(String),
31
32    /// Model loading error
33    #[error("Model loading error: {0}")]
34    LoadError(String),
35
36    /// Core error
37    #[error("Core error: {0}")]
38    CoreError(#[from] axonml_core::Error),
39
40    /// IO error (string to avoid duplicate From impl)
41    #[error("IO error: {0}")]
42    IoError(String),
43
44    /// Network error
45    #[error("Network error: {0}")]
46    NetworkError(String),
47
48    /// Parse error
49    #[error("Parse error: {0}")]
50    ParseError(String),
51
52    /// Model not found
53    #[error("Model not found: {0}")]
54    ModelNotFound(String),
55
56    /// Weight not found
57    #[error("Weight not found: {0}")]
58    WeightNotFound(String),
59
60    /// Unsupported format
61    #[error("Unsupported format: {0}")]
62    UnsupportedFormat(String),
63
64    /// Tensor error
65    #[error("Tensor error: {0}")]
66    TensorError(String),
67}