pub struct OverallCost {
pub prompt_tokens: usize,
pub completion_tokens: usize,
pub total_tokens: usize,
pub cost_usd: Option<f64>,
}Expand description
Cost ledger carried on an eval Report (E1).
Token buckets accumulate every reported predictor usage; cost_usd is Some only when at
least one usage had a model that the configured price book knows. Default is all-zero + None
so old reports serialize compatibly under #[serde(default)].
Fields§
§prompt_tokens: usizeTotal prompt tokens across the run.
completion_tokens: usizeTotal completion tokens across the run.
total_tokens: usizeTotal tokens (prompt + completion).
cost_usd: Option<f64>Estimated USD cost of the run; None when no priced usage was reported.
Implementations§
Source§impl OverallCost
impl OverallCost
Sourcepub fn accumulate(&mut self, usage: &TokenUsage, book: &PriceBook)
pub fn accumulate(&mut self, usage: &TokenUsage, book: &PriceBook)
Adds a usage report, accumulating token totals and (when priced) the USD estimate.
Trait Implementations§
Source§impl Clone for OverallCost
impl Clone for OverallCost
Source§fn clone(&self) -> OverallCost
fn clone(&self) -> OverallCost
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 OverallCost
impl Debug for OverallCost
Source§impl Default for OverallCost
impl Default for OverallCost
Source§fn default() -> OverallCost
fn default() -> OverallCost
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for OverallCost
impl<'de> Deserialize<'de> for OverallCost
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 OverallCost
impl RefUnwindSafe for OverallCost
impl Send for OverallCost
impl Sync for OverallCost
impl Unpin for OverallCost
impl UnsafeUnpin for OverallCost
impl UnwindSafe for OverallCost
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