pub struct UsageSnapshot {
pub prompt_tokens: u64,
pub requests: u64,
pub cache_hits: u64,
pub cache_misses: u64,
pub failures: u64,
}Expand description
Snapshot of usage statistics.
Fields§
§prompt_tokens: u64Total prompt tokens used.
requests: u64Total API requests made.
cache_hits: u64Number of cache hits.
cache_misses: u64Number of cache misses.
failures: u64Number of failed requests.
Implementations§
Source§impl UsageSnapshot
impl UsageSnapshot
Sourcepub fn cache_hit_rate(&self) -> f64
pub fn cache_hit_rate(&self) -> f64
Calculate cache hit rate.
Sourcepub fn estimated_cost_usd(&self, model: OpenAIModel) -> f64
pub fn estimated_cost_usd(&self, model: OpenAIModel) -> f64
Estimate cost in USD (approximate, based on public pricing).
Trait Implementations§
Source§impl Clone for UsageSnapshot
impl Clone for UsageSnapshot
Source§fn clone(&self) -> UsageSnapshot
fn clone(&self) -> UsageSnapshot
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 UsageSnapshot
impl RefUnwindSafe for UsageSnapshot
impl Send for UsageSnapshot
impl Sync for UsageSnapshot
impl Unpin for UsageSnapshot
impl UnsafeUnpin for UsageSnapshot
impl UnwindSafe for UsageSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request