GetTokenUsage

Trait GetTokenUsage 

Source
pub trait GetTokenUsage {
    // Required method
    fn token_usage(&self) -> Option<Usage>;
}
Expand description

A trait for grabbing the token usage of a completion response.

Primarily designed for streamed completion responses in streamed multi-turn, as otherwise it would be impossible to do.

Required Methods§

Implementations on Foreign Types§

Source§

impl GetTokenUsage for ()

Implementors§

Source§

impl GetTokenUsage for rig::providers::anthropic::streaming::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::cohere::streaming::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::deepseek::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::gemini::streaming::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::groq::StreamingCompletionResponse

Source§

impl GetTokenUsage for CompletionResponse

Source§

impl GetTokenUsage for rig::providers::ollama::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::openai::completion::streaming::StreamingCompletionResponse

Source§

impl GetTokenUsage for rig::providers::openai::responses_api::streaming::StreamingCompletionResponse

Source§

impl GetTokenUsage for FinalCompletionResponse