pub struct Usage {
pub prompt_tokens: u32,
pub completion_tokens: u32,
pub total_tokens: u32,
pub prompt_tokens_details: Option<PromptTokenUsageInfo>,
pub completion_tokens_details: Option<CompletionTokensDetails>,
}Fields§
§prompt_tokens: u32§completion_tokens: u32§total_tokens: u32§prompt_tokens_details: Option<PromptTokenUsageInfo>§completion_tokens_details: Option<CompletionTokensDetails>Implementations§
Source§impl Usage
impl Usage
Sourcepub fn from_counts(prompt_tokens: u32, completion_tokens: u32) -> Self
pub fn from_counts(prompt_tokens: u32, completion_tokens: u32) -> Self
Create a Usage from prompt and completion token counts
Sourcepub fn with_cached_tokens(self, cached_tokens: u32) -> Self
pub fn with_cached_tokens(self, cached_tokens: u32) -> Self
Add cached token details to this Usage
Sourcepub fn with_reasoning_tokens(self, reasoning_tokens: u32) -> Self
pub fn with_reasoning_tokens(self, reasoning_tokens: u32) -> Self
Add reasoning token details to this Usage
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Usage
impl<'de> Deserialize<'de> for Usage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Usage
impl JsonSchema for Usage
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
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