pub enum SamplerInitError {
InteriorNul {
field: &'static str,
source: NulError,
},
NullReturn(&'static str),
TooManyDrySequenceBreakers {
distinct: usize,
max: usize,
},
}Expand description
Why a sampler could not be constructed.
The panicking constructors — LlamaSampler::grammar and friends — are
kept for the common case where the grammar is a literal or came from
ChatParams::grammar, and a failure really is a
bug. These exist for the case they handle badly: a grammar, rule name or
trigger pattern that arrived from a request, where an interior NUL is bad
input rather than a broken invariant.
Variants§
InteriorNul
A caller-supplied string contained an interior NUL, so it cannot cross
the FFI boundary. field names which argument.
Fields
NullReturn(&'static str)
llama.cpp returned null. For a grammar sampler this is what an unparseable GBNF grammar looks like; it logs the parse error itself.
TooManyDrySequenceBreakers
More distinct DRY sequence breakers than llama.cpp will accept. It silently drops the surplus, so this is reported rather than passed on.
Fields
distinct: usizeHow many distinct breakers the caller supplied, counted the way llama.cpp counts them.
max: usizeThe upstream limit, DRY_MAX_SEQ_BREAKERS.
Trait Implementations§
Source§impl Debug for SamplerInitError
impl Debug for SamplerInitError
Source§impl Display for SamplerInitError
impl Display for SamplerInitError
impl Eq for SamplerInitError
Source§impl Error for SamplerInitError
impl Error for SamplerInitError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()