(&self)
| 251 | } |
| 252 | |
| 253 | pub fn prompt(&self) -> Option<&str> { |
| 254 | match self.content() { |
| 255 | UserMessageContent::Prompt { prompt } => Some(prompt.as_str()), |
| 256 | UserMessageContent::CancelledToolUses { prompt, .. } => prompt.as_ref().map(|s| s.as_str()), |
| 257 | UserMessageContent::ToolUseResults { .. } => None, |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | /// Truncates the content contained in this user message to a maximum length of `max_bytes`. |
| 262 | pub fn truncate_safe(&mut self, max_bytes: usize) { |
no test coverage detected