pub struct UsageStats {
pub total_prompt_tokens: u64,
pub total_completion_tokens: u64,
pub total_tokens: u64,
pub request_count: u64,
pub estimated_cost_cents: f64,
}Expand description
Accumulated usage statistics
Fields§
§total_prompt_tokens: u64Total prompt/input tokens
total_completion_tokens: u64Total completion/output tokens
total_tokens: u64Total tokens (prompt + completion)
request_count: u64Number of requests
estimated_cost_cents: f64Estimated cost in cents (if pricing is set)
Implementations§
Source§impl UsageStats
impl UsageStats
Sourcepub fn estimated_cost_usd(&self) -> f64
pub fn estimated_cost_usd(&self) -> f64
Get estimated cost in dollars
Sourcepub fn avg_tokens_per_request(&self) -> f64
pub fn avg_tokens_per_request(&self) -> f64
Get average tokens per request
Trait Implementations§
Source§impl Clone for UsageStats
impl Clone for UsageStats
Source§fn clone(&self) -> UsageStats
fn clone(&self) -> UsageStats
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 moreAuto Trait Implementations§
impl Freeze for UsageStats
impl RefUnwindSafe for UsageStats
impl Send for UsageStats
impl Sync for UsageStats
impl Unpin for UsageStats
impl UnwindSafe for UsageStats
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