pub struct LlmSample {
pub tokens_in: u64,
pub tokens_out: u64,
pub cached_tokens: u64,
pub reasoning_tokens: u64,
pub cost_micros: Option<u64>,
}Expand description
One metered LLM request’s token/cost breakdown, passed to Metrics::record_llm_usage. Carries
the four token dimensions plus the cost (present only when the model was priced). Grouping them in
a struct keeps the call site readable and the four dims impossible to transpose positionally.
Fields§
§tokens_in: u64§tokens_out: u64§cached_tokens: u64Cached prompt tokens (⊆ tokens_in).
reasoning_tokens: u64Reasoning completion tokens (⊆ tokens_out).
cost_micros: Option<u64>Cost in micro-dollars; None when the model is unpriced (tokens still counted).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlmSample
impl RefUnwindSafe for LlmSample
impl Send for LlmSample
impl Sync for LlmSample
impl Unpin for LlmSample
impl UnsafeUnpin for LlmSample
impl UnwindSafe for LlmSample
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