Skip to main content

Message

Defined in the LLM Providers module.
Rust AI Agent SDK A message in a conversation

Fields

NameTypeDescription
roleRoleThe role of the message sender
contentStringThe content of the message
Option:is_none")]Tool call ID (for tool responses)
tool_call_idOption<String>Tool call ID (for tool responses)
Option:is_none")]Tool calls made by the assistant
tool_callsOption<Vec<ToolCall>>Tool calls made by the assistant

Methods

system

fn system(content: impl Into<String>) -> Self
Create a system message Parameters:
NameType
contentimpl Into&lt;String&gt;

user

fn user(content: impl Into<String>) -> Self
Create a user message Parameters:
NameType
contentimpl Into&lt;String&gt;

assistant

fn assistant(content: impl Into<String>) -> Self
Create an assistant message Parameters:
NameType
contentimpl Into&lt;String&gt;

tool

fn tool(tool_call_id: impl Into<String>, content: impl Into<String>) -> Self
Create a tool response message Parameters:
NameType
tool_call_idimpl Into&lt;String&gt;
contentimpl Into&lt;String&gt;