pub enum StreamEvent {
TextDelta(String),
ToolCallStart {
id: String,
name: String,
},
ToolCallDelta {
id: String,
arguments_delta: String,
},
ToolCallEnd {
id: String,
},
ToolResult {
id: String,
content: String,
is_error: bool,
},
Usage {
iteration: usize,
input_tokens: u32,
output_tokens: u32,
estimated_cost: f64,
},
Error(String),
Done,
}Expand description
An event emitted during a streaming model response.
Variants§
TextDelta(String)
A chunk of generated text.
ToolCallStart
A tool call is starting (name and ID known, arguments pending).
ToolCallDelta
A chunk of tool call arguments (JSON fragment).
ToolCallEnd
A tool call’s arguments are complete and the tool will be executed.
ToolResult
A tool has produced its result.
Usage
Token usage and cost for the current iteration.
Emitted after each model invocation completes (once per ReAct iteration). During streaming, token counts are estimated from character length (~4 chars/token).
Error(String)
An error occurred during streaming (non-fatal; the stream may continue).
Done
The stream is complete.
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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