Skip to main content

llama_cpp_bindings/error/
grammar_error.rs

1use std::ffi::NulError;
2
3#[derive(Debug, thiserror::Error)]
4pub enum GrammarError {
5    #[error("grammar root not found in grammar string")]
6    RootNotFound,
7    #[error("trigger word contains null bytes: {0}")]
8    TriggerWordNullBytes(NulError),
9    #[error("grammar string or root contains null bytes: {0}")]
10    GrammarNullBytes(NulError),
11    #[error("string contains null bytes: {0}")]
12    NulError(#[from] NulError),
13    #[error("integer overflow: {0}")]
14    IntegerOverflow(String),
15    #[error("llguidance error: {0}")]
16    LlguidanceError(String),
17    #[error("grammar is malformed")]
18    GrammarMalformed,
19    #[error("lazy grammar is malformed")]
20    LazyGrammarMalformed,
21    #[error("lazy-patterns grammar is malformed")]
22    LazyPatternsGrammarMalformed,
23    #[error("trigger pattern is not a valid regex: {message}")]
24    InvalidTriggerPattern { message: String },
25    #[error("llguidance sampler could not be created")]
26    LlguidanceSamplerUnavailable,
27    #[error("not enough memory")]
28    NotEnoughMemory,
29    #[error("{message}")]
30    Reported { message: String },
31}