pub enum StreamChunk {
TextDelta {
delta: String,
},
ToolCallStart {
id: String,
name: String,
},
ToolCallArgsDelta {
id: String,
delta: String,
},
ToolCallEnd {
id: String,
},
Usage(TokenUsage),
End {
finish_reason: FinishReason,
},
}Expand description
One incremental event from a streaming LLM call.
Ordering guarantees:
TextDeltachunks appear in the order they should be concatenated.- For a given tool-call
id, events arrive asToolCallStart → ToolCallArgsDelta* → ToolCallEnd. Usage(if present) andEndare the last two chunks of a successful stream. On error the stream terminates withErr(_)and noEnd.
Variants§
TextDelta
ToolCallStart
ToolCallArgsDelta
ToolCallEnd
Usage(TokenUsage)
End
Fields
§
finish_reason: FinishReasonImplementations§
Source§impl StreamChunk
impl StreamChunk
pub fn kind_label(&self) -> &'static str
Trait Implementations§
Source§impl Clone for StreamChunk
impl Clone for StreamChunk
Source§fn clone(&self) -> StreamChunk
fn clone(&self) -> StreamChunk
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 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