#[non_exhaustive]pub enum ModelStreamEvent {
Show 15 variants
ResponseStarted {
id: Option<String>,
model: ModelRef,
},
ContentBlockStarted {
index: u32,
kind: ContentBlockKind,
},
TextDelta {
index: u32,
text: String,
},
ReasoningDelta {
index: u32,
text: String,
},
ReasoningSignatureDelta {
index: u32,
signature: String,
},
ToolArgumentsDelta {
index: u32,
json: String,
},
RefusalDelta {
index: u32,
text: String,
},
BinaryDelta {
index: u32,
data: String,
},
ContentBlockCompleted {
index: u32,
},
ContentPartCompleted {
index: u32,
part: ContentPart,
},
UsageUpdated {
usage: ModelUsage,
},
Warning {
warning: ModelWarning,
},
Heartbeat,
Provider {
event: ProviderEvent,
},
ResponseCompleted {
finish_reason: FinishReason,
provider_metadata: BTreeMap<String, Value>,
},
}Expand description
Canonical events emitted by a streaming model call.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ResponseStarted
The provider accepted the request and started a response.
Fields
ContentBlockStarted
A delta-capable content block started.
Fields
§
kind: ContentBlockKindBlock type and initial metadata.
TextDelta
A text delta.
ReasoningDelta
A reasoning-text delta.
ReasoningSignatureDelta
A reasoning-signature delta.
ToolArgumentsDelta
A raw JSON fragment for tool arguments.
RefusalDelta
A refusal-text delta.
BinaryDelta
One independently base64-encoded binary media chunk.
Fields
ContentBlockCompleted
A delta-capable block completed.
ContentPartCompleted
A complete non-delta content part arrived.
UsageUpdated
A cumulative usage snapshot.
Fields
§
usage: ModelUsageLatest cumulative model usage.
Warning
A translation or feature-degradation warning.
Fields
§
warning: ModelWarningVisible warning.
Heartbeat
A provider heartbeat without model content.
Provider
An unknown or provider-specific event.
Fields
§
event: ProviderEventRetained provider event.
ResponseCompleted
The response completed.
Trait Implementations§
Source§impl Clone for ModelStreamEvent
impl Clone for ModelStreamEvent
Source§fn clone(&self) -> ModelStreamEvent
fn clone(&self) -> ModelStreamEvent
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 moreSource§impl Debug for ModelStreamEvent
impl Debug for ModelStreamEvent
Source§impl<'de> Deserialize<'de> for ModelStreamEvent
impl<'de> Deserialize<'de> for ModelStreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ModelStreamEvent
impl PartialEq for ModelStreamEvent
Source§impl Serialize for ModelStreamEvent
impl Serialize for ModelStreamEvent
impl StructuralPartialEq for ModelStreamEvent
Auto Trait Implementations§
impl Freeze for ModelStreamEvent
impl RefUnwindSafe for ModelStreamEvent
impl Send for ModelStreamEvent
impl Sync for ModelStreamEvent
impl Unpin for ModelStreamEvent
impl UnsafeUnpin for ModelStreamEvent
impl UnwindSafe for ModelStreamEvent
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