pub struct TokenCount {
pub input_tokens: u32,
}Available on crate features
models and anthropic only.Expand description
Result of a token counting request.
Contains the input token count for a given request without generating a response.
§Example
ⓘ
use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
use adk_core::LlmRequest;
let client = AnthropicClient::new(AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6"))?;
let request = LlmRequest::default();
let count = client.count_tokens(&request).await?;
println!("Input tokens: {}", count.input_tokens);Fields§
§input_tokens: u32The total number of input tokens across messages, system prompt, and tools.
Trait Implementations§
Source§impl Clone for TokenCount
impl Clone for TokenCount
Source§fn clone(&self) -> TokenCount
fn clone(&self) -> TokenCount
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 TokenCount
impl Debug for TokenCount
Source§impl PartialEq for TokenCount
impl PartialEq for TokenCount
Source§fn eq(&self, other: &TokenCount) -> bool
fn eq(&self, other: &TokenCount) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TokenCount
impl Eq for TokenCount
impl StructuralPartialEq for TokenCount
Auto Trait Implementations§
impl Freeze for TokenCount
impl RefUnwindSafe for TokenCount
impl Send for TokenCount
impl Sync for TokenCount
impl Unpin for TokenCount
impl UnsafeUnpin for TokenCount
impl UnwindSafe for TokenCount
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.