pub struct Message {
pub role: Role,
pub content: Option<String>,
pub name: Option<String>,
pub tool_call_id: Option<String>,
pub tool_calls: Option<Vec<ToolCall>>,
pub reasoning_content: Option<String>,
pub prefix: Option<bool>,
}Fields§
§role: Roledefault role is User
content: Option<String>The content may be null for assistant messages (only when tool_calls are present)
name: Option<String>Optional name to identify a user or function
tool_call_id: Option<String>Required when role = “tool”; links to the previous tool call ID
tool_calls: Option<Vec<ToolCall>>Present when role = “assistant” and the model requested tool calls
reasoning_content: Option<String>Reasoning content produced by the model (may appear only in responses)
prefix: Option<bool>Beta: if true, forces the model to begin its reply with the prefix content provided in this assistant message
Implementations§
Source§impl Message
impl Message
pub fn new(role: Role, message: &str) -> Self
pub fn user(message: &str) -> Self
pub fn assistant(message: &str) -> Self
pub fn system(message: &str) -> Self
Sourcepub fn is_auto_summary(&self) -> bool
pub fn is_auto_summary(&self) -> bool
Returns true if this is an auto-generated summary message produced by
a built-in Summarizer implementation.
Auto-summary messages are Role::System messages whose name field is
set to AUTO_SUMMARY_TAG. They may be replaced on subsequent
summarization passes. All other Role::System messages are permanent
user-provided prompts and must never be removed by a summarizer.