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