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.
StreamEvent
Defined in the streaming module.
Rust AI Agent SDK
A single streaming event emitted during LLM response streaming.
Fields
| Name | Type | Description |
|---|
event_type | StreamEventType | Event type |
timestamp | u64 | Timestamp (milliseconds since epoch) |
content | Option<String> | Text content for DeltaText events |
tool_call | Option<ToolCallData> | Tool call data for DeltaToolCall events |
metadata | HashMap<String | Additional metadata |
error | Option<String> | Error message for Error events |
is_reasoning | bool | Whether this is reasoning/thinking content |
agent_id | Option<String> | Agent ID for multi-agent scenarios |
session_id | Option<String> | Session ID for tracking |
run_id | Option<String> | Run ID for correlation |
Methods
new
fn new(event_type: StreamEventType) -> Self
Create a new stream event
Parameters:
| Name | Type |
|---|
event_type | StreamEventType |
content
fn content(mut self, content: impl Into<String>) -> Self
Set content
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
fn tool_call(mut self, tool_call: ToolCallData) -> Self
Set tool call
Parameters:
| Name | Type |
|---|
tool_call | ToolCallData |
error
fn error(mut self, error: impl Into<String>) -> Self
Set error
Parameters:
| Name | Type |
|---|
error | impl Into<String> |
reasoning
fn reasoning(mut self, is_reasoning: bool) -> Self
Set as reasoning content
Parameters:
agent_id
fn agent_id(mut self, id: impl Into<String>) -> Self
Set agent ID
Parameters:
| Name | Type |
|---|
id | impl Into<String> |
session_id
fn session_id(mut self, id: impl Into<String>) -> Self
Set session ID
Parameters:
| Name | Type |
|---|
id | impl Into<String> |
run_id
fn run_id(mut self, id: impl Into<String>) -> Self
Set run ID
Parameters:
| Name | Type |
|---|
id | impl Into<String> |
fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self
Add metadata
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | impl Into<String> |
request_start
fn request_start() -> Self
Create a request start event
first_token
fn first_token(content: impl Into<String>) -> Self
Create a first token event
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
delta_text
fn delta_text(content: impl Into<String>) -> Self
Create a delta text event
Parameters:
| Name | Type |
|---|
content | impl Into<String> |
stream_end
Create a stream end event
error_event
fn error_event(message: impl Into<String>) -> Self
Create an error event
Parameters:
| Name | Type |
|---|
message | impl Into<String> |
Source
View on GitHub
praisonai/src/streaming/mod.rs at line 119