pub struct Message {
pub role: Role,
pub content: Option<String>,
pub parts: Vec<ContentPart>,
pub tool_calls: Vec<ToolCall>,
pub tool_call_id: Option<ToolCallId>,
pub name: Option<String>,
}Expand description
A single conversation message.
Fields§
§role: RoleRole.
content: Option<String>Text content when not multimodal.
parts: Vec<ContentPart>Multimodal parts (preferred when present).
tool_calls: Vec<ToolCall>Tool calls from the assistant.
tool_call_id: Option<ToolCallId>Tool call id when role is tool.
name: Option<String>Tool name when role is tool.
Implementations§
Source§impl Message
impl Message
Sourcepub const fn assistant_tools(tool_calls: Vec<ToolCall>) -> Self
pub const fn assistant_tools(tool_calls: Vec<ToolCall>) -> Self
Assistant message with tool calls.
Sourcepub fn tool_result(
tool_call_id: ToolCallId,
name: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn tool_result( tool_call_id: ToolCallId, name: impl Into<String>, content: impl Into<String>, ) -> Self
Tool result message.
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
impl StructuralPartialEq for Message
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