/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// LiveContextWindowUsage : The latest measured context-window usage of the Live model. This is separate from billing usage and delegated Responses token usage.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveContextWindowUsage {
/// The latest active context token count divided by the Live model context limit. Can decrease after compaction and may lag between measured audio frames.
#[serde(rename = "usage_ratio")]
pub usage_ratio: f64,
}
impl LiveContextWindowUsage {
/// The latest measured context-window usage of the Live model. This is separate from billing usage and delegated Responses token usage.
pub fn new(usage_ratio: f64) -> LiveContextWindowUsage {
LiveContextWindowUsage { usage_ratio }
}
}
impl std::fmt::Display for LiveContextWindowUsage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}