pub struct CompletionUsage {
pub completion_tokens: u64,
pub prompt_tokens: u64,
pub total_tokens: u64,
pub completion_tokens_details: Option<CompletionUsageCompletionTokensDetails>,
pub prompt_tokens_details: Option<CompletionUsagePromptTokensDetails>,
}
Expand description
Usage statistics for the completion request.
Fields§
§completion_tokens: u64
Number of tokens in the generated completion.
prompt_tokens: u64
Number of tokens in the prompt.
total_tokens: u64
Total number of tokens used in the request (prompt + completion).
completion_tokens_details: Option<CompletionUsageCompletionTokensDetails>
Breakdown of tokens used in a completion.
prompt_tokens_details: Option<CompletionUsagePromptTokensDetails>
Breakdown of tokens used in the prompt.
Implementations§
Source§impl CompletionUsage
impl CompletionUsage
Sourcepub fn builder() -> CompletionUsageBuilder<((), (), (), (), ())>
pub fn builder() -> CompletionUsageBuilder<((), (), (), (), ())>
Create a builder for building CompletionUsage
.
On the builder, call .completion_tokens(...)
, .prompt_tokens(...)
, .total_tokens(...)
, .completion_tokens_details(...)
(optional), .prompt_tokens_details(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of CompletionUsage
.
Trait Implementations§
Source§impl Clone for CompletionUsage
impl Clone for CompletionUsage
Source§fn clone(&self) -> CompletionUsage
fn clone(&self) -> CompletionUsage
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 moreSource§impl Debug for CompletionUsage
impl Debug for CompletionUsage
Source§impl<'de> Deserialize<'de> for CompletionUsage
impl<'de> Deserialize<'de> for CompletionUsage
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 PartialEq for CompletionUsage
impl PartialEq for CompletionUsage
Source§impl Serialize for CompletionUsage
impl Serialize for CompletionUsage
impl Copy for CompletionUsage
impl StructuralPartialEq for CompletionUsage
Auto Trait Implementations§
impl Freeze for CompletionUsage
impl RefUnwindSafe for CompletionUsage
impl Send for CompletionUsage
impl Sync for CompletionUsage
impl Unpin for CompletionUsage
impl UnwindSafe for CompletionUsage
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