pub enum MessageStreamEvent {
Ping,
MessageStart(MessageStartEvent),
MessageDelta(MessageDeltaEvent),
ContentBlockStart(ContentBlockStartEvent),
ContentBlockDelta(ContentBlockDeltaEvent),
ContentBlockStop(ContentBlockStopEvent),
MessageStop(MessageStopEvent),
ToolInputStart {
tool_use_id: String,
parameter_name: String,
},
ToolInputDelta {
tool_use_id: String,
parameter_name: String,
value_fragment: String,
},
CompactionEvent(CompactionMetadata),
StreamError {
error: ApiError,
},
}anthropic-client only.Expand description
An event in a message stream.
This enum represents all possible events that can occur when streaming messages from the Anthropic API. Events are delivered in a specific order: message_start, then potentially multiple content_block events, and finally message_stop.
Variants§
Ping
A periodic ping event to keep the connection alive.
MessageStart(MessageStartEvent)
Indicates the start of a new message in the stream.
MessageDelta(MessageDeltaEvent)
Provides incremental updates to the message being generated.
ContentBlockStart(ContentBlockStartEvent)
Marks the beginning of a new content block within the message.
ContentBlockDelta(ContentBlockDeltaEvent)
Provides incremental updates to the current content block.
ContentBlockStop(ContentBlockStopEvent)
Indicates that the current content block is complete.
MessageStop(MessageStopEvent)
Marks the end of the message stream.
ToolInputStart
Fine-grained tool streaming: parameter start (Req 20).
Fields
ToolInputDelta
Fine-grained tool streaming: parameter delta (Req 20).
Fields
CompactionEvent(CompactionMetadata)
Compaction event during streaming (Req 3.8, 16.2).
StreamError
Stream error (Req 3.9).
Trait Implementations§
Source§impl Clone for MessageStreamEvent
impl Clone for MessageStreamEvent
Source§fn clone(&self) -> MessageStreamEvent
fn clone(&self) -> MessageStreamEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageStreamEvent
impl Debug for MessageStreamEvent
Source§impl<'de> Deserialize<'de> for MessageStreamEvent
impl<'de> Deserialize<'de> for MessageStreamEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageStreamEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageStreamEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MessageStreamEvent
impl PartialEq for MessageStreamEvent
Source§impl Serialize for MessageStreamEvent
impl Serialize for MessageStreamEvent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MessageStreamEvent
Auto Trait Implementations§
impl Freeze for MessageStreamEvent
impl RefUnwindSafe for MessageStreamEvent
impl Send for MessageStreamEvent
impl Sync for MessageStreamEvent
impl Unpin for MessageStreamEvent
impl UnsafeUnpin for MessageStreamEvent
impl UnwindSafe for MessageStreamEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request