Struct UsageMetadata
pub struct UsageMetadata {
pub prompt_token_count: Option<u32>,
pub cached_content_token_count: Option<u32>,
pub response_token_count: Option<u32>,
pub tool_use_prompt_token_count: Option<u32>,
pub thoughts_token_count: Option<u32>,
pub total_token_count: Option<u32>,
pub prompt_tokens_details: Vec<ModalityTokenCount>,
pub cache_tokens_details: Vec<ModalityTokenCount>,
pub response_tokens_details: Vec<ModalityTokenCount>,
pub tool_use_prompt_tokens_details: Vec<ModalityTokenCount>,
}Expand description
Usage metadata returned by the server on messages.
Contains token counts for the prompt, response, cached content, tool use, and thinking, with optional per-modality breakdowns.
Fields§
§prompt_token_count: Option<u32>Number of tokens in the prompt.
cached_content_token_count: Option<u32>Number of tokens in the cached portion of the prompt.
response_token_count: Option<u32>Total number of tokens across all generated response candidates.
tool_use_prompt_token_count: Option<u32>Number of tokens present in tool-use prompt(s).
thoughts_token_count: Option<u32>Number of tokens of thoughts for thinking models.
total_token_count: Option<u32>Total token count for the generation request (prompt + response).
prompt_tokens_details: Vec<ModalityTokenCount>Per-modality breakdown of prompt tokens.
cache_tokens_details: Vec<ModalityTokenCount>Per-modality breakdown of cached content tokens.
response_tokens_details: Vec<ModalityTokenCount>Per-modality breakdown of response tokens.
tool_use_prompt_tokens_details: Vec<ModalityTokenCount>Per-modality breakdown of tool-use prompt tokens.
Trait Implementations§
§impl Clone for UsageMetadata
impl Clone for UsageMetadata
§fn clone(&self) -> UsageMetadata
fn clone(&self) -> UsageMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for UsageMetadata
impl Debug for UsageMetadata
§impl<'de> Deserialize<'de> for UsageMetadata
impl<'de> Deserialize<'de> for UsageMetadata
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UsageMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl PartialEq for UsageMetadata
impl PartialEq for UsageMetadata
§impl Serialize for UsageMetadata
impl Serialize for UsageMetadata
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for UsageMetadata
impl StructuralPartialEq for UsageMetadata
Auto Trait Implementations§
impl Freeze for UsageMetadata
impl RefUnwindSafe for UsageMetadata
impl Send for UsageMetadata
impl Sync for UsageMetadata
impl Unpin for UsageMetadata
impl UnwindSafe for UsageMetadata
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more