#[non_exhaustive]pub enum StreamEvent {
TextDelta(String),
ReasoningDelta(String),
ToolCallStart {
index: u32,
id: String,
name: String,
},
ToolCallDelta {
index: u32,
json_chunk: String,
},
ToolCallComplete {
index: u32,
call: ToolCall,
},
Usage(Usage),
Done {
stop_reason: StopReason,
},
}Expand description
An incremental event emitted during a streaming response.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
TextDelta(String)
A fragment of the model’s text output.
ReasoningDelta(String)
A fragment of the model’s reasoning (chain-of-thought) output.
ToolCallStart
Announces that a new tool call has started.
Fields
ToolCallDelta
A JSON fragment of the tool call’s arguments.
Fields
ToolCallComplete
The fully assembled tool call, ready to execute.
Fields
Usage(Usage)
Token usage information for the request so far.
Done
The stream has ended.
Fields
§
stop_reason: StopReasonWhy the model stopped generating.
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 moreSource§impl Debug for StreamEvent
impl Debug for StreamEvent
Source§impl<'de> Deserialize<'de> for StreamEvent
impl<'de> Deserialize<'de> for StreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StreamEvent
impl PartialEq for StreamEvent
Source§impl Serialize for StreamEvent
impl Serialize for StreamEvent
impl StructuralPartialEq 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 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