pub struct StreamEvent {
pub message_start: Option<MessageStartEvent>,
pub content_block_start: Option<ContentBlockStartEvent>,
pub content_block_delta: Option<ContentBlockDeltaEvent>,
pub content_block_stop: Option<ContentBlockStopEvent>,
pub message_stop: Option<MessageStopEvent>,
pub metadata: Option<MetadataEvent>,
pub redact_content: Option<RedactContentEvent>,
pub internal_server_exception: Option<ExceptionEvent>,
pub model_stream_error_exception: Option<ModelStreamErrorEvent>,
pub throttling_exception: Option<ExceptionEvent>,
pub validation_exception: Option<ExceptionEvent>,
pub service_unavailable_exception: Option<ExceptionEvent>,
}Expand description
A streaming event from the model.
Fields§
§message_start: Option<MessageStartEvent>§content_block_start: Option<ContentBlockStartEvent>§content_block_delta: Option<ContentBlockDeltaEvent>§content_block_stop: Option<ContentBlockStopEvent>§message_stop: Option<MessageStopEvent>§metadata: Option<MetadataEvent>§redact_content: Option<RedactContentEvent>§internal_server_exception: Option<ExceptionEvent>§model_stream_error_exception: Option<ModelStreamErrorEvent>§throttling_exception: Option<ExceptionEvent>§validation_exception: Option<ExceptionEvent>Implementations§
Source§impl StreamEvent
impl StreamEvent
pub fn message_start(role: Role) -> Self
pub fn content_block_start(index: u32, start: Option<ContentBlockStart>) -> Self
pub fn content_block_delta(index: u32, delta: ContentBlockDelta) -> Self
pub fn text_delta(index: u32, text: impl Into<String>) -> Self
pub fn tool_use_delta(index: u32, input: impl Into<String>) -> Self
pub fn tool_use_start( index: u32, name: impl Into<String>, tool_use_id: impl Into<String>, ) -> Self
pub fn reasoning_delta(index: u32, text: impl Into<String>) -> Self
pub fn content_block_stop(index: u32) -> Self
pub fn message_stop(stop_reason: StopReason) -> Self
pub fn metadata(usage: Usage, metrics: Metrics) -> Self
pub fn is_text_delta(&self) -> bool
pub fn as_text_delta(&self) -> Option<&str>
pub fn is_message_stop(&self) -> bool
pub fn stop_reason(&self) -> Option<StopReason>
pub fn is_error(&self) -> bool
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 · 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 Default for StreamEvent
impl Default for StreamEvent
Source§fn default() -> StreamEvent
fn default() -> StreamEvent
Returns the “default value” for a type. Read more
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§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 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
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.