pub struct ContextWindowUsage {
pub fresh_input: FreshInputTokens,
pub cache_creation: CacheCreationTokens,
pub cache_read: CacheReadTokens,
pub output: OutputTokens,
}Expand description
Complete snapshot of token usage for a single turn.
Fields§
§fresh_input: FreshInputTokens§cache_creation: CacheCreationTokens§cache_read: CacheReadTokens§output: OutputTokensImplementations§
Source§impl ContextWindowUsage
impl ContextWindowUsage
pub fn new( fresh_input: FreshInputTokens, cache_creation: CacheCreationTokens, cache_read: CacheReadTokens, output: OutputTokens, ) -> Self
pub fn from_raw( fresh_input: i32, cache_creation: i32, cache_read: i32, output: i32, ) -> Self
Sourcepub fn input_tokens(&self) -> i32
pub fn input_tokens(&self) -> i32
Input-side tokens (fresh + cache creation + cache read)
Sourcepub fn output_tokens(&self) -> i32
pub fn output_tokens(&self) -> i32
Output-side tokens (model generation)
Sourcepub fn total_tokens(&self) -> TokenCount
pub fn total_tokens(&self) -> TokenCount
Context window tokens as type-safe TokenCount
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Add for ContextWindowUsage
impl Add for ContextWindowUsage
Source§impl Clone for ContextWindowUsage
impl Clone for ContextWindowUsage
Source§fn clone(&self) -> ContextWindowUsage
fn clone(&self) -> ContextWindowUsage
Returns a duplicate of the value. Read more
1.0.0 · 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 ContextWindowUsage
impl Debug for ContextWindowUsage
Source§impl Default for ContextWindowUsage
impl Default for ContextWindowUsage
Source§fn default() -> ContextWindowUsage
fn default() -> ContextWindowUsage
Returns the “default value” for a type. Read more
Source§impl PartialEq for ContextWindowUsage
impl PartialEq for ContextWindowUsage
impl Copy for ContextWindowUsage
impl Eq for ContextWindowUsage
impl StructuralPartialEq for ContextWindowUsage
Auto Trait Implementations§
impl Freeze for ContextWindowUsage
impl RefUnwindSafe for ContextWindowUsage
impl Send for ContextWindowUsage
impl Sync for ContextWindowUsage
impl Unpin for ContextWindowUsage
impl UnwindSafe for ContextWindowUsage
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