Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
SessionMessage
Defined in the session module.
Rust AI Agent SDK
A single message in a session
Fields
| Name | Type | Description |
|---|
role | "user" | - |
role | String | Message role: “user”, “assistant”, “system” |
content | String | Message content |
timestamp | f64 | Unix timestamp |
metadata | HashMap<String | Optional metadata |
serde_json | :Value> | Optional metadata |
Methods
new
fn new(role: impl Into<String>, content: impl Into<String>) -> Self
Create a new session message
Parameters:
| Name | Type |
|---|
role | impl Into<String> |
content | impl Into<String> |
user
fn user(content: impl Into<String>) -> Self
Create a user message
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
assistant
fn assistant(content: impl Into<String>) -> Self
Create an assistant message
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
system
fn system(content: impl Into<String>) -> Self
Create a system message
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
fn with_metadata(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
Add metadata
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | serde_json::Value |
to_message
fn to_message(&self) -> Message
Convert to LLM Message
Source
View on GitHub
praisonai/src/session/mod.rs at line 51