Skip to main content

spec_stream_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug, Clone, PartialEq)]
4pub enum CoreError {
5    #[error("Dimension mismatch: expected {expected}, got {actual}")]
6    DimensionMismatch { expected: usize, actual: usize },
7
8    #[error("Empty logits provided for sampling or verification")]
9    EmptyLogits,
10
11    #[error("Invalid temperature: {0} (must be strictly positive)")]
12    InvalidTemperature(f32),
13
14    #[error("Invalid top_p parameter: {0} (must be in range (0.0, 1.0])")]
15    InvalidTopP(f32),
16
17    #[error("Invalid min_p parameter: {0} (must be in range [0.0, 1.0])")]
18    InvalidMinP(f32),
19
20    #[error("Invalid repetition penalty: {0} (must be strictly positive)")]
21    InvalidPenalty(f32),
22
23    #[error("Invalid draft proposal length: expected at least 1 token")]
24    EmptyDraftProposal,
25
26    #[error("Tree structure error: {0}")]
27    TreeError(String),
28}