next_web_ai/chat/meta_data/
usage.rs

1use next_web_core::DynClone;
2
3pub trait Usage: Send + Sync
4where
5    Self: DynClone,
6{
7    fn get_prompt_tokens(&self) -> u32;
8
9    fn get_completion_tokens(&self) -> u32;
10
11    fn get_total_tokens(&self) -> u64 {
12        (self.get_prompt_tokens() + self.get_completion_tokens()).into()
13    }
14}
15
16next_web_core::clone_trait_object!(Usage);