langfuse_client/models/
usage_by_model.rs

1/*
2 * langfuse
3 *
4 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json
5 *
6 * The version of the OpenAPI document: 
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// UsageByModel : Daily usage of a given model. Usage corresponds to the unit set for the specific model (e.g. tokens).
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UsageByModel {
17    #[serde(rename = "model", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
18    pub model: Option<Option<String>>,
19    /// Total number of generation input units (e.g. tokens)
20    #[serde(rename = "inputUsage")]
21    pub input_usage: i32,
22    /// Total number of generation output units (e.g. tokens)
23    #[serde(rename = "outputUsage")]
24    pub output_usage: i32,
25    /// Total number of generation total units (e.g. tokens)
26    #[serde(rename = "totalUsage")]
27    pub total_usage: i32,
28    #[serde(rename = "countTraces")]
29    pub count_traces: i32,
30    #[serde(rename = "countObservations")]
31    pub count_observations: i32,
32    /// Total model cost in USD
33    #[serde(rename = "totalCost")]
34    pub total_cost: f64,
35}
36
37impl UsageByModel {
38    /// Daily usage of a given model. Usage corresponds to the unit set for the specific model (e.g. tokens).
39    pub fn new(input_usage: i32, output_usage: i32, total_usage: i32, count_traces: i32, count_observations: i32, total_cost: f64) -> UsageByModel {
40        UsageByModel {
41            model: None,
42            input_usage,
43            output_usage,
44            total_usage,
45            count_traces,
46            count_observations,
47            total_cost,
48        }
49    }
50}
51