language_models: Emit UsageUpdate events for token usage in DeepSeek and OpenAI (#33242)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Umesh Yadav 2025-06-25 13:12:30 +05:30 committed by GitHub
parent 098896146e
commit 108162423d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 12 deletions

View file

@ -201,13 +201,13 @@ pub struct Response {
#[derive(Serialize, Deserialize, Debug)]
pub struct Usage {
pub prompt_tokens: u32,
pub completion_tokens: u32,
pub total_tokens: u32,
pub prompt_tokens: u64,
pub completion_tokens: u64,
pub total_tokens: u64,
#[serde(default)]
pub prompt_cache_hit_tokens: u32,
pub prompt_cache_hit_tokens: u64,
#[serde(default)]
pub prompt_cache_miss_tokens: u32,
pub prompt_cache_miss_tokens: u64,
}
#[derive(Serialize, Deserialize, Debug)]
@ -224,6 +224,7 @@ pub struct StreamResponse {
pub created: u64,
pub model: String,
pub choices: Vec<StreamChoice>,
pub usage: Option<Usage>,
}
#[derive(Serialize, Deserialize, Debug)]