#[non_exhaustive]pub enum ChatStreamEvent {
Started {
provider: ProviderId,
model: ModelName,
},
TextDelta {
delta: String,
},
ToolCallStarted {
id: String,
name: String,
},
ToolCallArgumentsDelta {
id: String,
delta: String,
},
ToolCallCompleted {
call: ToolCall,
},
Finished {
finish_reason: FinishReason,
usage: Option<TokenUsage>,
},
}Expand description
Event emitted by a streaming chat provider.
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.
Started
Stream has started.
TextDelta
Text delta produced by the model.
ToolCallStarted
Tool call has started.
ToolCallArgumentsDelta
Tool call argument JSON delta.
ToolCallCompleted
Tool call has completed and can be executed.
Finished
Stream has finished.
Fields
§
finish_reason: FinishReasonReason the provider stopped generation.
§
usage: Option<TokenUsage>Token accounting, when supplied by the provider.
Trait Implementations§
Source§impl Clone for ChatStreamEvent
impl Clone for ChatStreamEvent
Source§fn clone(&self) -> ChatStreamEvent
fn clone(&self) -> ChatStreamEvent
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 ChatStreamEvent
impl Debug for ChatStreamEvent
Source§impl<'de> Deserialize<'de> for ChatStreamEvent
impl<'de> Deserialize<'de> for ChatStreamEvent
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 ChatStreamEvent
impl PartialEq for ChatStreamEvent
Source§fn eq(&self, other: &ChatStreamEvent) -> bool
fn eq(&self, other: &ChatStreamEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ChatStreamEvent
impl Serialize for ChatStreamEvent
impl StructuralPartialEq for ChatStreamEvent
Auto Trait Implementations§
impl Freeze for ChatStreamEvent
impl RefUnwindSafe for ChatStreamEvent
impl Send for ChatStreamEvent
impl Sync for ChatStreamEvent
impl Unpin for ChatStreamEvent
impl UnsafeUnpin for ChatStreamEvent
impl UnwindSafe for ChatStreamEvent
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