Skip to main content

llama_cpp_bindings/error/
logits_error.rs

1/// When logits-related functions fail
2#[derive(Debug, Eq, PartialEq, thiserror::Error)]
3pub enum LogitsError {
4    /// The logits data pointer is null.
5    #[error("logits data pointer is null")]
6    NullLogits,
7    /// The requested token index has not been initialized for logits.
8    #[error("logit for token index {0} is not initialized")]
9    TokenNotInitialized(i32),
10    /// The token index exceeds the context size.
11    #[error("token index {token_index} exceeds context size {context_size}")]
12    TokenIndexExceedsContext {
13        /// The token index that was requested.
14        token_index: u32,
15        /// The context size.
16        context_size: u32,
17    },
18    /// The vocabulary size does not fit into a usize.
19    #[error("n_vocab does not fit into usize: {0}")]
20    VocabSizeOverflow(#[source] std::num::TryFromIntError),
21    /// The token index does not fit into a u32.
22    #[error("token_index does not fit into u32: {0}")]
23    TokenIndexOverflow(#[source] std::num::TryFromIntError),
24}