pub struct Message {
pub id: Option<String>,
pub role: Role,
pub content: String,
pub tool_calls: Option<Vec<ToolCall>>,
pub tool_call_id: Option<String>,
pub visibility: Visibility,
pub metadata: Option<MessageMetadata>,
}Expand description
A message in the conversation.
Fields§
§id: Option<String>Stable message identifier (UUID v7, auto-generated).
role: Role§content: String§tool_calls: Option<Vec<ToolCall>>Tool calls made by the assistant.
tool_call_id: Option<String>Tool call ID this message responds to (for tool role).
visibility: VisibilityMessage visibility. Defaults to All (visible everywhere).
Internal messages (e.g. system reminders) are only sent to the LLM.
metadata: Option<MessageMetadata>Optional run/step association metadata.
Implementations§
Source§impl Message
impl Message
Sourcepub fn internal_system(content: impl Into<String>) -> Self
pub fn internal_system(content: impl Into<String>) -> Self
Create an internal system message (visible only to LLM, hidden from API consumers).
Use this for plugin-injected reminders, system hints, and other messages that should be part of the LLM context but not exposed to end users.
Sourcepub fn assistant_with_tool_calls(
content: impl Into<String>,
calls: Vec<ToolCall>,
) -> Self
pub fn assistant_with_tool_calls( content: impl Into<String>, calls: Vec<ToolCall>, ) -> Self
Create an assistant message with tool calls.
Sourcepub fn tool(call_id: impl Into<String>, content: impl Into<String>) -> Self
pub fn tool(call_id: impl Into<String>, content: impl Into<String>) -> Self
Create a tool response message.
Sourcepub fn with_metadata(self, metadata: MessageMetadata) -> Self
pub fn with_metadata(self, metadata: MessageMetadata) -> Self
Attach run/step metadata to this 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
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