pub enum StreamChunk {
Text(String),
ToolCall(ToolCall),
ToolCallDelta {
id: String,
content: ToolCallDeltaContent,
},
Reasoning(Reasoning),
ReasoningDelta {
id: Option<String>,
text: String,
},
Final(FinalResponse),
}Expand description
One streamed item of a completion response.
Deltas stream incremental UI-facing content; the non-delta variants
(ToolCall, Reasoning) carry the complete block to be recorded in
history. A well-formed stream ends with Final (though providers may
terminate without one, e.g. on network errors).
Variants§
Text(String)
A chunk of assistant text.
ToolCall(ToolCall)
A complete tool call (all arguments accumulated).
ToolCallDelta
An incremental piece of an in-progress tool call.
Reasoning(Reasoning)
A complete reasoning block.
ReasoningDelta
A chunk of reasoning text.
Final(FinalResponse)
The final chunk, carrying the completion’s token usage (if the provider reports it).
Trait Implementations§
Source§impl Clone for StreamChunk
impl Clone for StreamChunk
Source§impl Debug for StreamChunk
impl Debug for StreamChunk
Source§impl<'de> Deserialize<'de> for StreamChunk
impl<'de> Deserialize<'de> for StreamChunk
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 StreamChunk
impl PartialEq for StreamChunk
Source§impl Serialize for StreamChunk
impl Serialize for StreamChunk
impl StructuralPartialEq for StreamChunk
Auto Trait Implementations§
impl Freeze for StreamChunk
impl RefUnwindSafe for StreamChunk
impl Send for StreamChunk
impl Sync for StreamChunk
impl Unpin for StreamChunk
impl UnsafeUnpin for StreamChunk
impl UnwindSafe for StreamChunk
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