Message • Rust AI Agent SDK

Message: A message in a conversation

Message

Defined in the LLM 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

rust
fn system(content: impl Into<String>) -> Self

Create a system message

Parameters:

NameType
contentimpl Into&lt;String&gt;

user

rust
fn user(content: impl Into<String>) -> Self

Create a user message

Parameters:

NameType
contentimpl Into&lt;String&gt;

assistant

rust
fn assistant(content: impl Into<String>) -> Self

Create an assistant message

Parameters:

NameType
contentimpl Into&lt;String&gt;

tool

rust
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;

Source

View on GitHub

praisonai/src/llm/mod.rs at line 39