pub struct AssistantMessage {
pub id: MessageId,
pub role: Role,
pub content: Option<String>,
pub name: Option<String>,
pub tool_calls: Option<Vec<ToolCall>>,
}Expand description
An assistant message (from the AI model).
Fields§
§id: MessageIdUnique identifier for this message.
role: RoleThe role (always Assistant).
content: Option<String>The text content of the message.
name: Option<String>Optional name for the sender.
tool_calls: Option<Vec<ToolCall>>Tool calls made by the assistant.
Implementations§
Source§impl AssistantMessage
impl AssistantMessage
Sourcepub fn new(id: impl Into<MessageId>) -> AssistantMessage
pub fn new(id: impl Into<MessageId>) -> AssistantMessage
Creates a new assistant message with the given ID.
Sourcepub fn with_content(self, content: String) -> AssistantMessage
pub fn with_content(self, content: String) -> AssistantMessage
Sets the content for this message.
Sourcepub fn with_name(self, name: String) -> AssistantMessage
pub fn with_name(self, name: String) -> AssistantMessage
Sets the name for this message.
Sourcepub fn with_tool_calls(self, tool_calls: Vec<ToolCall>) -> AssistantMessage
pub fn with_tool_calls(self, tool_calls: Vec<ToolCall>) -> AssistantMessage
Sets the tool calls for this message.
Trait Implementations§
Source§impl Clone for AssistantMessage
impl Clone for AssistantMessage
Source§fn clone(&self) -> AssistantMessage
fn clone(&self) -> AssistantMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AssistantMessage
impl Debug for AssistantMessage
Source§impl<'de> Deserialize<'de> for AssistantMessage
impl<'de> Deserialize<'de> for AssistantMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AssistantMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AssistantMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AssistantMessage
impl PartialEq for AssistantMessage
Source§impl Serialize for AssistantMessage
impl Serialize for AssistantMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for AssistantMessage
Auto Trait Implementations§
impl Freeze for AssistantMessage
impl RefUnwindSafe for AssistantMessage
impl Send for AssistantMessage
impl Sync for AssistantMessage
impl Unpin for AssistantMessage
impl UnsafeUnpin for AssistantMessage
impl UnwindSafe for AssistantMessage
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