Skip to main content

GatewayMessage

Defined in the gateway module.
Rust AI Agent SDK A message sent through the gateway.

Fields

NameTypeDescription
contentserde_json::ValueMessage content (text or structured data)
sender_idStringSender identifier
session_idStringSession this message belongs to
message_idStringUnique message identifier
timestampf64Message creation time (Unix timestamp)
metadataHashMap<StringAdditional message metadata
serde_json:Value>Additional message metadata
reply_toOption<String>ID of message being replied to (optional)

Methods

new

fn new(
        content: impl Into<serde_json::Value>,
        sender_id: impl Into<String>,
        session_id: impl Into<String>,
    ) -> Self
Create a new gateway message. Parameters:
NameType
contentimpl Into&lt;serde_json::Value&gt;
sender_idimpl Into&lt;String&gt;
session_idimpl Into&lt;String&gt;

text

fn text(
        text: impl Into<String>,
        sender_id: impl Into<String>,
        session_id: impl Into<String>,
    ) -> Self
Create a text message. Parameters:
NameType
textimpl Into&lt;String&gt;
sender_idimpl Into&lt;String&gt;
session_idimpl Into&lt;String&gt;

reply_to

fn reply_to(mut self, message_id: impl Into<String>) -> Self
Set reply_to message ID. Parameters:
NameType
message_idimpl Into&lt;String&gt;

metadata

fn metadata(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
Add metadata. Parameters:
NameType
keyimpl Into&lt;String&gt;
valueserde_json::Value

text_content

fn text_content(&self) -> Option<&str>
Get text content if available.

Source

View on GitHub

praisonai/src/gateway/mod.rs at line 190