pub struct CacheReport {
pub prefix: usize,
pub variable: usize,
pub turns: usize,
pub cacheable_ratio: f64,
pub cost_uncached: usize,
pub cost_cached: usize,
pub savings_ratio: f64,
}Expand description
How much a representation benefits from API prompt-caching: the per-turn prompt splits into a stable, cacheable prefix and a variable remainder. With caching the prefix is paid once at write price and thereafter at the cheap read price — so a representation with a large stable prefix is far cheaper per session.
Fields§
§prefix: usizeTokens in the stable, cache-eligible prefix.
variable: usizeTokens in the variable (non-cacheable) remainder of each turn’s prompt.
turns: usizeSession length modeled.
cacheable_ratio: f64Fraction of the per-turn prompt that is cacheable.
cost_uncached: usizeCost with no caching: (prefix + variable) × turns.
cost_cached: usizeCost with prompt caching: prefix written once (×1.25), read on later turns (×0.1), plus the variable remainder every turn.
savings_ratio: f64cost_uncached / cost_cached (≥ 1.0): how many times cheaper caching is.
Trait Implementations§
Source§impl Clone for CacheReport
impl Clone for CacheReport
Source§fn clone(&self) -> CacheReport
fn clone(&self) -> CacheReport
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 CacheReport
impl Debug for CacheReport
Source§impl Display for CacheReport
impl Display for CacheReport
Auto Trait Implementations§
impl Freeze for CacheReport
impl RefUnwindSafe for CacheReport
impl Send for CacheReport
impl Sync for CacheReport
impl Unpin for CacheReport
impl UnsafeUnpin for CacheReport
impl UnwindSafe for CacheReport
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