pub enum StreamEvent {
Show 13 variants
Start {
provider: &'static str,
model: String,
metadata: ResponseMetadata,
},
TextDelta {
text: String,
},
ReasoningDelta {
kind: ReasoningKind,
text: String,
},
ToolCallDelta {
index: usize,
id: Option<String>,
name: Option<String>,
arguments_delta: String,
},
ToolCallProgress {
index: usize,
id: Option<String>,
name: Option<String>,
arguments_so_far: String,
},
NativeToolProgress {
index: usize,
item_id: Option<String>,
input_so_far: String,
},
NativeToolCompleted {
index: usize,
call: NativeToolCall,
},
ServerToolStatus {
tool: String,
call_id: Option<String>,
state: ServerToolState,
},
Usage {
usage: Usage,
},
Retry {
delay: Duration,
},
Retrying {
attempt: u32,
max_attempts: u32,
delay: Duration,
reason: String,
},
Error {
error: StreamError,
},
Done {
response: Box<ChatResponse>,
finish_reason: Option<String>,
},
}Expand description
A provider-neutral streaming event.
Variants§
Start
The HTTP response was accepted and the stream is starting.
TextDelta
Incremental assistant-visible text.
ReasoningDelta
Incremental reasoning summary or readable reasoning text.
ToolCallDelta
Incremental tool-call data.
index identifies the tool call within the assistant message.
ToolCallProgress
The complete tool arguments accumulated so far for a call.
NativeToolProgress
Raw custom input progress. This event is not proof of completion.
NativeToolCompleted
A completed native item. Applications must still apply cancellation and response-level scheduling policy before executing a write.
ServerToolStatus
A provider-hosted or built-in tool changed state.
Usage
Usage reported during the stream. Providers may send this only at the end.
Retry
A server-directed SSE retry delay.
Retrying
The SDK scheduled a retry or reconnect with stable metadata.
Error
A recoverable stream error. Terminal errors are returned as Err.
Fields
error: StreamErrorDone
The stream completed and the SDK assembled a normal response.
Consumers that persist conversation history should append
response.message, not reconstruct it from deltas.