#[non_exhaustive]pub struct BudgetSpend {
pub model_calls: u64,
pub prompt_tokens: u64,
}Expand description
What a turn has spent so far.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model_calls: u64Model calls made, retries and fallbacks included.
prompt_tokens: u64Prompt tokens the providers reported.
Implementations§
Source§impl BudgetSpend
impl BudgetSpend
Sourcepub const fn with_model_calls(self, model_calls: u64) -> Self
pub const fn with_model_calls(self, model_calls: u64) -> Self
Returns a copy with another call count.
Sourcepub const fn with_prompt_tokens(self, prompt_tokens: u64) -> Self
pub const fn with_prompt_tokens(self, prompt_tokens: u64) -> Self
Returns a copy with another token count.
Sourcepub fn of(attempts: &[ProviderAttempt]) -> Self
pub fn of(attempts: &[ProviderAttempt]) -> Self
Measures a turn’s attempt trail.
Every attempt is one model call, whatever became of it: a retry after a timeout cost the same call as the answer that followed it. Tokens are counted only where a provider reported them, because a provider that reports nothing has told us nothing, and inventing an estimate would make the bound a guess.
A cancelled attempt is not counted: the caller went away before the provider was asked to do anything.
Trait Implementations§
Source§impl Clone for BudgetSpend
impl Clone for BudgetSpend
impl Copy for BudgetSpend
Source§impl Debug for BudgetSpend
impl Debug for BudgetSpend
Source§impl Default for BudgetSpend
impl Default for BudgetSpend
impl Eq for BudgetSpend
Source§impl PartialEq for BudgetSpend
impl PartialEq for BudgetSpend
impl StructuralPartialEq for BudgetSpend
Auto Trait Implementations§
impl Freeze for BudgetSpend
impl RefUnwindSafe for BudgetSpend
impl Send for BudgetSpend
impl Sync for BudgetSpend
impl Unpin for BudgetSpend
impl UnsafeUnpin for BudgetSpend
impl UnwindSafe for BudgetSpend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.