#[non_exhaustive]pub enum StreamDelta {
Start {
id: String,
model: String,
provider_echoes: Vec<ProviderEchoSnapshot>,
},
TextDelta {
text: String,
provider_echoes: Vec<ProviderEchoSnapshot>,
},
ThinkingDelta {
text: String,
provider_echoes: Vec<ProviderEchoSnapshot>,
},
ToolUseStart {
id: String,
name: String,
provider_echoes: Vec<ProviderEchoSnapshot>,
},
ToolUseInputDelta {
partial_json: String,
},
ToolUseStop,
Usage(Usage),
RateLimit(RateLimitSnapshot),
Warning(ModelWarning),
Stop {
stop_reason: StopReason,
},
}Expand description
One chunk from a streaming model response.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Start
First message — vendor’s response id and model identifier.
Fields
provider_echoes: Vec<ProviderEchoSnapshot>Response-level vendor opaque round-trip tokens — OpenAI
Responses Response.id (so the next request can chain via
previous_response_id from ModelRequest::continued_from),
or anything else the codec wants to carry at response root
rather than on a single content part. The aggregator
surfaces these on ModelResponse::provider_echoes at
finalize time, mirroring the non-streaming decode path.
TextDelta
Append text to the in-progress text block. Consecutive TextDeltas
fold into a single ContentPart::Text in the output.
Fields
provider_echoes: Vec<ProviderEchoSnapshot>Vendor opaque round-trip tokens this fragment carries
(Gemini 3.x attaches thought_signature to text parts on
reasoning turns). The aggregator extends the open-text
block’s accumulated echoes — a single ContentPart::Text
finalises with the union of every delta’s echoes.
ThinkingDelta
Append text (or vendor opaque tokens) to the in-progress
thinking block. Consecutive ThinkingDeltas fold into a
single ContentPart::Thinking in the output. A delta carrying
only provider_echoes (empty text) attaches the round-trip
marker without growing the body — Anthropic emits the
signature on a discrete signature_delta SSE event with no
associated text.
Fields
provider_echoes: Vec<ProviderEchoSnapshot>Vendor opaque round-trip tokens (Anthropic signature,
Gemini thought_signature, OpenAI Responses
encrypted_content). Codecs pre-wrap the wire-shape blob
into ProviderEchoSnapshot before yielding the delta;
the aggregator stays codec-agnostic and just accumulates.
ToolUseStart
Begin a new tool-use block. Closes any open text block so the output preserves the model’s intended ordering.
Fields
provider_echoes: Vec<ProviderEchoSnapshot>Vendor opaque round-trip tokens attached to this tool call
(Gemini 3.x thought_signature on functionCall parts —
missing on the next turn yields HTTP 400 on the first
functionCall of a step).
ToolUseInputDelta
Append partial JSON to the open tool-use block’s input buffer.
Fields
ToolUseStop
Close the current tool-use block. Returns Err if the buffered
JSON does not parse.
Usage(Usage)
Token usage update (last value wins).
RateLimit(RateLimitSnapshot)
Provider rate-limit snapshot, typically emitted as the leading
chunk by ChatModel::stream_deltas before the first content
delta. Last value wins inside an aggregator.
Warning(ModelWarning)
Provider warning surfaced inline.
Stop
End of stream with stop reason.
Fields
stop_reason: StopReasonReason the model halted.
Trait Implementations§
Source§impl Clone for StreamDelta
impl Clone for StreamDelta
Source§fn clone(&self) -> StreamDelta
fn clone(&self) -> StreamDelta
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamDelta
impl Debug for StreamDelta
Source§impl PartialEq for StreamDelta
impl PartialEq for StreamDelta
Source§fn eq(&self, other: &StreamDelta) -> bool
fn eq(&self, other: &StreamDelta) -> bool
self and other values to be equal, and is used by ==.impl Eq for StreamDelta
impl StructuralPartialEq for StreamDelta
Auto Trait Implementations§
impl Freeze for StreamDelta
impl RefUnwindSafe for StreamDelta
impl Send for StreamDelta
impl Sync for StreamDelta
impl Unpin for StreamDelta
impl UnsafeUnpin for StreamDelta
impl UnwindSafe for StreamDelta
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.