pub struct StreamCollector { /* private fields */ }Expand description
Collector for streaming LLM responses.
Processes stream events and accumulates text and tool calls.
Implementations§
Source§impl StreamCollector
impl StreamCollector
Sourcepub fn process(&mut self, event: ChatStreamEvent) -> Option<StreamOutput>
pub fn process(&mut self, event: ChatStreamEvent) -> Option<StreamOutput>
Process a stream event and optionally return an output event.
This is a pure-ish function - it updates internal state and returns an output event if something notable happened.
Sourcepub fn finish(self) -> StreamResult
pub fn finish(self) -> StreamResult
Finish collecting and return the final result.
Sourcepub fn has_tool_calls(&self) -> bool
pub fn has_tool_calls(&self) -> bool
Check if any tool calls have been collected.
Trait Implementations§
Source§impl Debug for StreamCollector
impl Debug for StreamCollector
Source§impl Default for StreamCollector
impl Default for StreamCollector
Source§fn default() -> StreamCollector
fn default() -> StreamCollector
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StreamCollector
impl RefUnwindSafe for StreamCollector
impl Send for StreamCollector
impl Sync for StreamCollector
impl Unpin for StreamCollector
impl UnsafeUnpin for StreamCollector
impl UnwindSafe for StreamCollector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more