pub enum StreamEvent {
TextDelta {
delta: String,
},
ThinkingDelta {
delta: String,
},
ToolCall {
id: String,
name: String,
arguments: Value,
},
Usage {
total_tokens: u32,
input_tokens: u32,
output_tokens: u32,
cache_read_input_tokens: u32,
cache_creation_input_tokens: u32,
cache_read_input_tokens_by_slot: Option<CacheReadBySlot>,
},
Done,
}Expand description
Stream event emitted by providers.
Variants§
TextDelta
ThinkingDelta
ToolCall
Usage
Token usage from the provider (e.g. OpenAI stream_options.include_usage).
Fields
§
cache_read_input_tokens: u32Prompt tokens served from cache (billed ~0.1x). Subset of input_tokens.
§
cache_creation_input_tokens: u32Prompt tokens written to cache (billed ~1.25x). Subset of input_tokens.
§
cache_read_input_tokens_by_slot: Option<CacheReadBySlot>I1: pro-rata per-slot attribution of cache_read_input_tokens (Anthropic only).
None when the provider doesn’t honor cache_control or when no breakpoints were
placed. Estimated (Anthropic returns a single scalar) — see helper docs.
Done
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