pub struct Message {
pub role: Role,
pub parts: Vec<Part>,
pub message_id: Option<String>,
pub task_id: Option<String>,
pub context_id: Option<String>,
pub metadata: Option<Value>,
}Fields§
§role: Role§parts: Vec<Part>§message_id: Option<String>§task_id: Option<String>§context_id: Option<String>§metadata: Option<Value>Implementations§
Source§impl Message
impl Message
pub fn user_text(s: impl Into<String>) -> Self
pub fn text_content(&self) -> Option<&str>
Sourcepub fn all_text_content(&self) -> String
pub fn all_text_content(&self) -> String
Collect and concatenate all Part::Text entries in order.
Unlike [text_content] which returns only the first text part, this method
preserves the full message when an agent sends multiple text parts.
Returns an empty string if the message contains no text parts.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more