pub enum StreamEvent {
ReasoningDelta(String),
ContentDelta(String),
ToolCallStart {
index: usize,
id: String,
name: String,
},
ToolCallDelta {
index: usize,
arguments: String,
},
Usage(TokenUsage),
AudioDelta {
data: Vec<u8>,
format: String,
},
FileAttachment {
filename: String,
media_type: String,
data: Vec<u8>,
},
Finished(FinishReason),
}Expand description
Events emitted incrementally by the provider’s stream.
Each variant corresponds to a server-side SSE/data-line event type.
Consumers assemble these into higher-level AgentEvents.
Variants§
ReasoningDelta(String)
Incremental reasoning/chain-of-thought token.
ContentDelta(String)
Incremental assistant text token.
ToolCallStart
The LLM started requesting a tool call at index.
ToolCallDelta
Incremental JSON argument string for the tool at index.
Usage(TokenUsage)
Token usage snapshot mid-stream (some providers emit this).
AudioDelta
Incremental audio output chunk (raw PCM/MP3 bytes).
FileAttachment
Out-of-band file delivered by the provider (e.g. generated image).
Finished(FinishReason)
Stream has ended; payload is the final finish reason.
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Auto 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