Deep copy of the message, preserving content blocks.
(self)
| 306 | return blocks |
| 307 | |
| 308 | def clone(self) -> "Message": |
| 309 | """Deep copy of the message, preserving content blocks.""" |
| 310 | return Message( |
| 311 | role=self.role, |
| 312 | content=_copy_content(self.content), |
| 313 | name=self.name, |
| 314 | tool_call_id=self.tool_call_id, |
| 315 | metadata=dict(self.metadata), |
| 316 | tool_calls=list(self.tool_calls), |
| 317 | keep=self.keep, |
| 318 | preserve_role=self.preserve_role, |
| 319 | ) |
| 320 | |
| 321 | def to_dict(self, include_data: bool = True) -> Dict[str, Any]: |
| 322 | """Return a JSON-serializable representation.""" |
no test coverage detected