pub struct Usage {
pub input: Option<u64>,
pub output: Option<u64>,
pub cache_read: Option<u64>,
pub cache_creation: Option<u64>,
pub thinking: Option<u64>,
}Expand description
What the harness has spent on this run so far.
Every member is cumulative for the harness run, never the increment since the last report: a harness that sends a running count as it streams and a final total at the end is reported verbatim, both times. The runtime attributes, to each turn it closes, only the growth of each member over what it has already attributed, so reporting the same total twice adds nothing and a member that shrinks contributes zero. A driver that reports deltas instead would be counted several times over.
Every member is independently optional. none means this harness does not report this
count and is never the same fact as 0, which means the harness reported spending none:
the runtime keeps the two apart all the way into the trace.
cache-read and cache-creation sit beside input, never inside it. A harness that
folds its cache counts into its input count must subtract them before reporting, so that
input is always the uncached prompt alone. thinking is a subset of output, not an
addition to it.
No cost figure and no context-window size is carried. A price a harness computed against its own table is a different claim from a token count, and the runtime has no equivalent on its other transport to make it mean the same thing on both.
Fields§
§input: Option<u64>Prompt tokens, excluding anything cache-read or cache-creation covers.
output: Option<u64>Generated tokens, including the thinking subset below.
cache_read: Option<u64>Prompt tokens served from the provider’s cache.
cache_creation: Option<u64>Prompt tokens written to the provider’s cache.
thinking: Option<u64>The part of output the harness reports as reasoning.
Trait Implementations§
impl ComponentType for Usage
impl Copy for Usage
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
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>,
impl Lift for Usage
impl Lower for Usage
Auto Trait Implementations§
impl Forget for Usage
impl Freeze for Usage
impl Move for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more