Stream Collector • Rust AI Agent SDK

StreamCollector: Collects stream events and accumulated 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

rust
fn new() -> Self

Create a new collector

process

rust
fn process(&mut self, event: StreamEvent) -> ()

Process an event

Parameters:

NameType
eventStreamEvent

get_content

rust
fn get_content(&self) -> &str

Get final content

event_count

rust
fn event_count(&self) -> usize

Get event count

is_complete

rust
fn is_complete(&self) -> bool

Check if streaming completed successfully

has_error

rust
fn has_error(&self) -> bool

Check if there was an error

get_error

rust
fn get_error(&self) -> Option<&str>

Get error message if any

Source

View on GitHub

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