pub enum StreamEvent {
Start,
TextDelta {
content_index: usize,
delta: String,
},
ThinkingDelta {
content_index: usize,
delta: String,
},
ToolCallStart {
content_index: usize,
id: String,
name: String,
},
ToolCallDelta {
content_index: usize,
delta: String,
},
ToolCallEnd {
content_index: usize,
},
Done {
message: Message,
},
Error {
message: Message,
},
}Expand description
Events emitted during LLM streaming.
Variants§
Start
Stream started — the LLM has begun generating. Consumers should create a placeholder.
TextDelta
A text token from the response text.
ThinkingDelta
A chunk from the model’s chain-of-thought (extended thinking mode only).
ToolCallStart
The LLM began a tool call — id and name are now known.
ToolCallDelta
A JSON fragment for a tool call’s arguments (accumulate until ToolCallEnd).
ToolCallEnd
The tool call’s argument JSON is complete.
Done
Stream completed successfully. message is the final complete Message.
Error
Stream failed. message is a synthetic error Message with stop_reason=Error.
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 (const: unstable) · 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