pub enum StreamDelta {
TextDelta {
delta: String,
},
ReasoningDelta {
delta: String,
},
ToolCallDelta {
call_index: usize,
provider_call_id: Option<String>,
name_delta: Option<String>,
arguments_delta: Option<String>,
},
Usage(ModelUsage),
Done {
stop_reason: ModelStopReason,
final_output: ModelOutput,
},
Error {
kind: ModelInvokeErrorKind,
message: String,
},
}Expand description
One incremental observation from a streaming provider.
Contract: Done MUST carry the fully-assembled ModelOutput (text,
tool-call drafts with stable ids, usage) — deltas are advisory
observations for hosts, never the source of truth. A stream that ends
without Done is an UnknownOutcome-shaped failure at the driver.
Variants§
TextDelta
An increment of assistant text.
ReasoningDelta
An increment of reasoning/thinking text.
ToolCallDelta
An increment of one streamed tool call, identified by its position among the model’s tool calls.
Fields
call_index: usizePosition of this call among the model’s tool-call drafts — how deltas are matched to calls.
Usage(ModelUsage)
A mid-stream token-usage observation.
Done
Terminal delta: generation ended. Carries the fully-assembled output — the source of truth per this enum’s contract.
Fields
stop_reason: ModelStopReasonThe terminal ModelStopReason.
final_output: ModelOutputThe fully-assembled ModelOutput — the authoritative result.
Error
In-stream failure observation, shaped like ModelInvokeError.
Fields
kind: ModelInvokeErrorKindThe failure classification.