Skip to main content

mistral_openapi_client/models/
usage_info.rs

1/*
2 * Mistral AI API
3 *
4 * Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct UsageInfo {
16    #[serde(rename = "prompt_tokens")]
17    pub prompt_tokens: i32,
18    #[serde(rename = "completion_tokens")]
19    pub completion_tokens: i32,
20    #[serde(rename = "total_tokens")]
21    pub total_tokens: i32,
22    #[serde(rename = "prompt_audio_seconds", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub prompt_audio_seconds: Option<Option<i32>>,
24}
25
26impl UsageInfo {
27    pub fn new(prompt_tokens: i32, completion_tokens: i32, total_tokens: i32) -> UsageInfo {
28        UsageInfo {
29            prompt_tokens,
30            completion_tokens,
31            total_tokens,
32            prompt_audio_seconds: None,
33        }
34    }
35}
36