#[non_exhaustive]pub enum AnthropicEvent {
MessageStart {},
ContentBlockStart {
index: u32,
content_block: AnthropicBlockStart,
},
ContentBlockDelta {
index: u32,
delta: AnthropicDelta,
},
ContentBlockStop {
index: u32,
},
MessageDelta {
delta: AnthropicMessageDelta,
},
MessageStop {},
Ping {},
Error {
error: AnthropicErrorBody,
},
Unknown,
}Expand description
One event from an Anthropic streaming response.
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.
MessageStart
Opens the response. Carries usage and the empty message envelope, neither of which the SDK needs.
ContentBlockStart
Opens a content block at index, declaring what kind it is.
Fields
§
content_block: AnthropicBlockStartThe block’s kind, and its identity when it is a tool call.
ContentBlockDelta
Appends to the block at index.
Fields
§
delta: AnthropicDeltaThe fragment to append, tagged by which channel it belongs to.
ContentBlockStop
Closes the block at index.
MessageDelta
Reports top-level message changes; this is where stop_reason arrives.
Fields
§
delta: AnthropicMessageDeltaThe changed fields.
MessageStop
Ends the response.
Ping
Keep-alive. Carries nothing.
Error
A mid-stream error, such as an overload. Terminates the response.
Fields
§
error: AnthropicErrorBodyThe error body.
Unknown
An event type this SDK does not recognise, ignored rather than fatal.
Trait Implementations§
Source§impl Clone for AnthropicEvent
impl Clone for AnthropicEvent
Source§fn clone(&self) -> AnthropicEvent
fn clone(&self) -> AnthropicEvent
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 AnthropicEvent
impl Debug for AnthropicEvent
Source§impl<'de> Deserialize<'de> for AnthropicEvent
impl<'de> Deserialize<'de> for AnthropicEvent
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
Auto Trait Implementations§
impl Freeze for AnthropicEvent
impl RefUnwindSafe for AnthropicEvent
impl Send for AnthropicEvent
impl Sync for AnthropicEvent
impl Unpin for AnthropicEvent
impl UnsafeUnpin for AnthropicEvent
impl UnwindSafe for AnthropicEvent
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