pub struct Usage {
pub input_tokens: u32,
pub output_tokens: u32,
pub cached_tokens: u32,
}Expand description
Token usage statistics for a single model request.
Fields§
§input_tokens: u32Number of input (prompt) tokens.
output_tokens: u32Number of output (completion) tokens.
cached_tokens: u32Number of input tokens served from the provider’s cache.
Implementations§
Source§impl Usage
impl Usage
Sourcepub fn total_tokens(&self) -> u32
pub fn total_tokens(&self) -> u32
Total tokens (input + output).
Sourcepub fn accumulate(&mut self, other: &Usage)
pub fn accumulate(&mut self, other: &Usage)
Accumulate another usage into this one.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
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