Returns the length of the content of the message event - ie, the number of bytes of content contained within the message. This doesn't reflect the actual number of bytes the message took up being serialized over the network.
(&self)
| 588 | /// This doesn't reflect the actual number of bytes the message took up being serialized over |
| 589 | /// the network. |
| 590 | pub fn len(&self) -> usize { |
| 591 | match self { |
| 592 | ChatResponseStream::AssistantResponseEvent { content } => content.len(), |
| 593 | ChatResponseStream::CodeEvent { content } => content.len(), |
| 594 | ChatResponseStream::CodeReferenceEvent(_) => 0, |
| 595 | ChatResponseStream::FollowupPromptEvent(_) => 0, |
| 596 | ChatResponseStream::IntentsEvent(_) => 0, |
| 597 | ChatResponseStream::InvalidStateEvent { .. } => 0, |
| 598 | ChatResponseStream::MessageMetadataEvent { .. } => 0, |
| 599 | ChatResponseStream::SupplementaryWebLinksEvent(_) => 0, |
| 600 | ChatResponseStream::ToolUseEvent { input, .. } => input.as_ref().map(|s| s.len()).unwrap_or_default(), |
| 601 | ChatResponseStream::Unknown => 0, |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | #[allow(dead_code)] |
| 606 | pub fn is_empty(&self) -> bool { |