pub enum StreamEvent {
MessageStart {
id: String,
model: String,
},
ContentBlockStart {
index: u32,
content_type: StreamingContentType,
},
Delta {
index: u32,
delta: StreamingDelta,
},
ContentBlockStop {
index: u32,
},
MessageDelta {
stop_reason: Option<StopReason>,
usage_delta: Option<Usage>,
},
MessageStop,
Ping,
}Expand description
A single event in a streaming completion.
Variants§
MessageStart
The message has started; carries the assigned ID and model.
Fields
ContentBlockStart
A content block is starting at the given index.
Fields
§
content_type: StreamingContentTypeThe type of content block that is starting.
Delta
An incremental delta for the block at the given index.
ContentBlockStop
The content block at the given index is complete.
MessageDelta
End-of-message metadata delta.
Fields
§
stop_reason: Option<StopReason>Why the model stopped, if known.
MessageStop
The message is fully complete.
Ping
A keep-alive ping from the provider.
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 moreSource§impl Debug for StreamEvent
impl Debug for StreamEvent
Source§impl<'de> Deserialize<'de> for StreamEvent
impl<'de> Deserialize<'de> for StreamEvent
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 StreamEvent
impl PartialEq for StreamEvent
Source§fn eq(&self, other: &StreamEvent) -> bool
fn eq(&self, other: &StreamEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for StreamEvent
impl Serialize for StreamEvent
impl StructuralPartialEq for StreamEvent
Auto 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