Skip to main content

StreamCollector

Defined in the streaming module.
Rust AI Agent SDK Collects stream events and accumulated content.

Fields

NameTypeDescription
eventsVec<StreamEvent>Collected events
contentStringAccumulated content
metricsStreamMetricsMetrics

Methods

new

fn new() -> Self
Create a new collector

process

fn process(&mut self, event: StreamEvent) -> ()
Process an event Parameters:
NameType
eventStreamEvent

get_content

fn get_content(&self) -> &str
Get final content

event_count

fn event_count(&self) -> usize
Get event count

is_complete

fn is_complete(&self) -> bool
Check if streaming completed successfully

has_error

fn has_error(&self) -> bool
Check if there was an error

get_error

fn get_error(&self) -> Option<&str>
Get error message if any

Source

View on GitHub

praisonai/src/streaming/mod.rs at line 424