pub struct ChatUsage {
pub openai: Usage,
pub extra: Map<String, Value>,
}Expand description
Chat Completions accounting with dialect-specific fields preserved for
the response’s raw.
Fields§
§openai: UsageThe OpenAI-compatible accounting.
extra: Map<String, Value>Fields this dialect adds.
Implementations§
Source§impl ChatUsage
impl ChatUsage
Sourcepub fn to_normalized(&self) -> Usage
pub fn to_normalized(&self) -> Usage
Normalize this accounting.
cached_input_tokens falls back to DeepSeek’s prompt_cache_hit_tokens,
which reports cache activity outside prompt_tokens_details; reading
only the OpenAI spelling would report no cache hit on a turn that was
entirely served from cache. (Mistral’s num_cached_tokens is a typed
field of Usage and handled by its own to_normalized.)
Sourcepub fn to_normalized_for(&self, quirks: &Quirks) -> Usage
pub fn to_normalized_for(&self, quirks: &Quirks) -> Usage
Normalize this accounting for a dialect with quirks, as the chat
wire does: Self::to_normalized, with the reasoning count left
unreported where the dialect’s count cannot be trusted
(Quirks::reliable_reasoning_count).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChatUsage
impl<'de> Deserialize<'de> for ChatUsage
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
Auto Trait Implementations§
impl Freeze for ChatUsage
impl RefUnwindSafe for ChatUsage
impl Send for ChatUsage
impl Sync for ChatUsage
impl Unpin for ChatUsage
impl UnsafeUnpin for ChatUsage
impl UnwindSafe for ChatUsage
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
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> 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 moreSource§impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
Source§fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
Convert this value without routing structured data through a string.