use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct Object022 {
#[serde(rename = "prompt_tokens")]
pub prompt_tokens: i32,
#[serde(rename = "total_tokens")]
pub total_tokens: i32,
#[serde(
rename = "completion_tokens",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub completion_tokens: Option<Option<i32>>,
#[serde(
rename = "cached_tokens",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub cached_tokens: Option<Option<i32>>,
}
impl Object022 {
pub fn new(prompt_tokens: i32, total_tokens: i32) -> Object022 {
Object022 {
prompt_tokens,
total_tokens,
completion_tokens: None,
cached_tokens: None,
}
}
}
impl std::fmt::Display for Object022 {
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),
}
}
}