Skip to main content

llama_cpp_bindings/
raw_chat_message.rs

1#[derive(Debug, Eq, PartialEq)]
2pub struct RawChatMessage {
3    pub tools_json: String,
4    pub text: String,
5    pub is_partial: bool,
6    pub ffi_error_message: String,
7}
8
9#[cfg(test)]
10mod tests {
11    use super::RawChatMessage;
12
13    #[test]
14    fn carries_tools_json_text_partial_flag_and_ffi_error_message() {
15        let raw = RawChatMessage {
16            tools_json: "[]".to_owned(),
17            text: "hello".to_owned(),
18            is_partial: true,
19            ffi_error_message: "parser bailed".to_owned(),
20        };
21
22        assert_eq!(raw.tools_json, "[]");
23        assert_eq!(raw.text, "hello");
24        assert!(raw.is_partial);
25        assert_eq!(raw.ffi_error_message, "parser bailed");
26    }
27}