pub struct Tokens {
pub input: u64,
pub output: u64,
pub source: TokenSource,
}Expand description
The tokens one call spent, and where the count came from.
Fields§
§input: u64§output: u64§source: TokenSourceImplementations§
Source§impl Tokens
impl Tokens
Sourcepub fn estimate(
profile: &ClassifierProfile,
state: &str,
questions: &BTreeMap<String, Question>,
answers: Option<&BTreeMap<String, Answer>>,
) -> Self
pub fn estimate( profile: &ClassifierProfile, state: &str, questions: &BTreeMap<String, Question>, answers: Option<&BTreeMap<String, Answer>>, ) -> Self
Estimates one call at ceil(chars / 4) per side.
Input is the state as the adapter sends it — truncated by
profile the way the adapter truncates it, so an over-long state
is not billed for text that never left — plus every question’s id,
instructions and criteria or levels (names and meanings). Output is
the answers rendered as id, value and every probability label with
its number to two places; None (a failed call) is zero output.
An estimate, tagged TokenSource::Estimated: each adapter wraps
the text in its own prompt and tokenizes it its own way. It compares
adapters asked the same questions fairly, and it is not what the
vendor will invoice.
Trait Implementations§
impl Copy for Tokens
impl Eq for Tokens
impl StructuralPartialEq for Tokens
Auto Trait Implementations§
impl Freeze for Tokens
impl RefUnwindSafe for Tokens
impl Send for Tokens
impl Sync for Tokens
impl Unpin for Tokens
impl UnsafeUnpin for Tokens
impl UnwindSafe for Tokens
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
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§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.