pub struct ModelCompletion { /* private fields */ }Expand description
Successful terminal model completion data.
Implementations§
Source§impl ModelCompletion
impl ModelCompletion
Sourcepub fn new(stop_reason: StopReason) -> Result<Self, ModelStreamValueError>
pub fn new(stop_reason: StopReason) -> Result<Self, ModelStreamValueError>
Creates successful terminal completion data.
§Errors
Returns an error for cancelled, error, or unknown stop reasons. Those
outcomes must use ModelEvent::Failed.
Sourcepub fn with_usage(self, usage: Usage) -> Self
pub fn with_usage(self, usage: Usage) -> Self
Adds normalized token usage.
Sourcepub fn with_metadata(self, metadata: ProtocolMetadata) -> Self
pub fn with_metadata(self, metadata: ProtocolMetadata) -> Self
Adds bounded terminal metadata.
Sourcepub const fn stop_reason(&self) -> &StopReason
pub const fn stop_reason(&self) -> &StopReason
Returns the normalized stop reason.
Sourcepub const fn cost(&self) -> Option<&ExactCost>
pub const fn cost(&self) -> Option<&ExactCost>
Returns exact provider-reported cost when available.
Sourcepub const fn metadata(&self) -> &ProtocolMetadata
pub const fn metadata(&self) -> &ProtocolMetadata
Returns bounded terminal metadata.
Trait Implementations§
Source§impl Clone for ModelCompletion
impl Clone for ModelCompletion
Source§fn clone(&self) -> ModelCompletion
fn clone(&self) -> ModelCompletion
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 ModelCompletion
impl Debug for ModelCompletion
Source§impl PartialEq for ModelCompletion
impl PartialEq for ModelCompletion
impl StructuralPartialEq for ModelCompletion
Auto Trait Implementations§
impl Freeze for ModelCompletion
impl RefUnwindSafe for ModelCompletion
impl Send for ModelCompletion
impl Sync for ModelCompletion
impl Unpin for ModelCompletion
impl UnsafeUnpin for ModelCompletion
impl UnwindSafe for ModelCompletion
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