llama_cpp_bindings/error/
parse_chat_message_error.rs1use std::string::FromUtf8Error;
2
3use crate::error::marker_detection_error::MarkerDetectionError;
4use crate::error::tool_call_format_failure::ToolCallFormatFailure;
5
6#[derive(Debug, thiserror::Error)]
7pub enum ParseChatMessageError {
8 #[error("model has no chat template")]
9 NoChatTemplate,
10 #[error("model has no vocab")]
11 NoVocab,
12 #[error("not enough memory")]
13 NotEnoughMemory,
14 #[error("chat-template parse failed: {message}")]
15 ParseFailed { message: String },
16 #[error("parsed-chat destructor failed: {message}")]
17 DestructorFailed { message: String },
18 #[error("tool-call id index {index} out of bounds")]
19 ToolCallIdIndexOutOfBounds { index: usize },
20 #[error("tool-call name index {index} out of bounds")]
21 ToolCallNameIndexOutOfBounds { index: usize },
22 #[error("tool-call arguments index {index} out of bounds")]
23 ToolCallArgumentsIndexOutOfBounds { index: usize },
24 #[error("ffi returned non-utf8 string: {0}")]
25 StringUtf8Error(#[from] FromUtf8Error),
26 #[error("tools_json is not valid JSON: {0}")]
27 ToolsJsonInvalid(#[source] serde_json::Error),
28 #[error("tools_json must be a JSON array")]
29 ToolsJsonNotArray,
30 #[error("could not serialize tools to JSON: {0}")]
31 ToolsSerialization(String),
32 #[error("template-override fallback parser failed: {0}")]
33 TemplateOverrideFailed(#[from] ToolCallFormatFailure),
34 #[error("reasoning-marker detection failed: {0}")]
35 MarkerDetection(#[from] MarkerDetectionError),
36 #[error("{message}")]
37 Reported { message: String },
38}