pub struct StreamCompletion {
pub finish_reason: Option<StopReason>,
pub usage: Usage,
}Expand description
The terminal summary of a streamed completion.
Why: the caller needs the same finish reason + normalized Usage the
buffered chat() path returns; collecting them into one terminal event means
downstream cost/telemetry code is identical whether or not streaming was used.
What: finish_reason is the typed stop condition (None when the provider
never sent one); usage is the normalized token/cost accounting (zeroed when
the provider did not include a usage chunk).
Test: decode_carries_usage_in_terminal.
Fields§
§finish_reason: Option<StopReason>Why the model stopped, when reported.
usage: UsageNormalized token + cost accounting for the streamed call.
Trait Implementations§
Source§impl Clone for StreamCompletion
impl Clone for StreamCompletion
Source§fn clone(&self) -> StreamCompletion
fn clone(&self) -> StreamCompletion
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 StreamCompletion
impl Debug for StreamCompletion
Source§impl PartialEq for StreamCompletion
impl PartialEq for StreamCompletion
impl StructuralPartialEq for StreamCompletion
Auto Trait Implementations§
impl Freeze for StreamCompletion
impl RefUnwindSafe for StreamCompletion
impl Send for StreamCompletion
impl Sync for StreamCompletion
impl Unpin for StreamCompletion
impl UnsafeUnpin for StreamCompletion
impl UnwindSafe for StreamCompletion
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> 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.