Skip to main content

llama_cpp_bindings/error/
marker_detection_error.rs

1use std::str::Utf8Error;
2use std::string::FromUtf8Error;
3
4use crate::error::chat_template_error::ChatTemplateError;
5use crate::error::string_to_token_error::StringToTokenError;
6
7#[derive(Debug, PartialEq, Eq, thiserror::Error)]
8pub enum MarkerDetectionError {
9    #[error("ffi returned non-utf8 marker bytes: {0}")]
10    MarkerUtf8Error(#[from] FromUtf8Error),
11    #[error("not enough memory")]
12    NotEnoughMemory,
13    #[error("reasoning-marker detection failed: {message}")]
14    ReasoningMarkerDetectionFailed { message: String },
15    #[error("tool-call haystack computation failed: {message}")]
16    ToolCallHaystackComputationFailed { message: String },
17    #[error("tool-call synthetic-render diagnosis failed: {message}")]
18    ToolCallSyntheticRenderDiagnosisFailed { message: String },
19    #[error("a detected marker string could not be tokenised: {0}")]
20    MarkerTokenizationFailed(#[from] StringToTokenError),
21    #[error("the chat template is not valid UTF-8: {0}")]
22    ToolCallTemplateNotUtf8(#[from] Utf8Error),
23    #[error("the chat template could not be retrieved for tool-call marker detection: {0}")]
24    ChatTemplateUnavailable(#[source] ChatTemplateError),
25}