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
| Name | Type | Description |
|---|---|---|
events | Vec<StreamEvent> | Collected events |
content | String | Accumulated content |
metrics | StreamMetrics | Metrics |
Methods
new
fn new() -> SelfCreate a new collector
process
fn process(&mut self, event: StreamEvent) -> ()Process an event
Parameters:
| Name | Type |
|---|---|
event | StreamEvent |
get_content
fn get_content(&self) -> &strGet final content
event_count
fn event_count(&self) -> usizeGet event count
is_complete
fn is_complete(&self) -> boolCheck if streaming completed successfully
has_error
fn has_error(&self) -> boolCheck if there was an error
get_error
fn get_error(&self) -> Option<&str>Get error message if any
Source
View on GitHubpraisonai/src/streaming/mod.rs at line 424