pub struct Message {
pub role: Role,
pub content: String,
pub tool_call_id: Option<String>,
pub tool_calls: Vec<ToolCall>,
pub images: Vec<ImagePart>,
}Expand description
A chat message in the conversation history.
Fields§
§role: Role§content: String§tool_call_id: Option<String>Tool call results (only for Role::Tool).
tool_calls: Vec<ToolCall>Tool calls made by the assistant (only for Role::Assistant with function calling). Gemini API requires model turns to include functionCall parts.
images: Vec<ImagePart>Inline images (for multimodal VLM input).
Implementations§
Source§impl Message
impl Message
pub fn system(content: impl Into<String>) -> Self
pub fn user(content: impl Into<String>) -> Self
pub fn assistant(content: impl Into<String>) -> Self
Sourcepub fn assistant_with_tool_calls(
content: impl Into<String>,
tool_calls: Vec<ToolCall>,
) -> Self
pub fn assistant_with_tool_calls( content: impl Into<String>, tool_calls: Vec<ToolCall>, ) -> Self
Create an assistant message that includes function calls (for Gemini FC protocol).
pub fn tool(call_id: impl Into<String>, content: impl Into<String>) -> Self
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