pub struct StreamingCompletionResponse {
pub usage: PartialUsage,
pub stop_reason: Option<String>,
pub stop_sequence: Option<String>,
pub message_id: Option<String>,
pub model: Option<String>,
pub provider_request_id: Option<String>,
}Expand description
Anthropic’s own terminal stream record, as returned by
[GenericCompletionModel::raw_stream].
crate::completion::CompletionModel::stream maps this once into the
normalized StreamFinal; callers who want the provider-native shape read
it here instead.
Fields§
§usage: PartialUsageToken usage carried by the terminal message_delta event.
stop_reason: Option<String>Anthropic’s stop_reason, verbatim, when the stream reported one.
stop_sequence: Option<String>Which of the caller’s stop_sequences actually fired, verbatim, when
the terminal message_delta reported one.
stop_reason: "stop_sequence" says only that a sequence matched;
the sequence itself is the part a caller branches on, and Anthropic
strips it from the text, so the wire is its only source. The blocking
twin has carried it on
CompletionResponse::stop_sequence
all along — the streamed record dropped it after parsing, so the same
request answered strictly less when streamed.
message_id: Option<String>The message_start message ID, when the stream reported one.
model: Option<String>The model named by message_start, when the stream reported one.
provider_request_id: Option<String>The transport request id from the SSE connection’s request-id
response header — not part of any stream frame; stamped by the
transport. None when the provider did not report one.
Trait Implementations§
Source§impl Clone for StreamingCompletionResponse
impl Clone for StreamingCompletionResponse
Source§fn clone(&self) -> StreamingCompletionResponse
fn clone(&self) -> StreamingCompletionResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamingCompletionResponse
impl Debug for StreamingCompletionResponse
Source§impl Default for StreamingCompletionResponse
impl Default for StreamingCompletionResponse
Source§fn default() -> StreamingCompletionResponse
fn default() -> StreamingCompletionResponse
Source§impl<'de> Deserialize<'de> for StreamingCompletionResponse
impl<'de> Deserialize<'de> for StreamingCompletionResponse
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>,
Auto Trait Implementations§
impl Freeze for StreamingCompletionResponse
impl RefUnwindSafe for StreamingCompletionResponse
impl Send for StreamingCompletionResponse
impl Sync for StreamingCompletionResponse
impl Unpin for StreamingCompletionResponse
impl UnsafeUnpin for StreamingCompletionResponse
impl UnwindSafe for StreamingCompletionResponse
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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 more