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)]
16#[cfg_attr(feature="bon", derive(bon::Builder))]
17pub struct UsageByModel {
18    #[serde(rename = "model", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub model: Option<Option<String>>,
20    /// Total number of generation input units (e.g. tokens)
21    #[serde(rename = "inputUsage")]
22    pub input_usage: i32,
23    /// Total number of generation output units (e.g. tokens)
24    #[serde(rename = "outputUsage")]
25    pub output_usage: i32,
26    /// Total number of generation total units (e.g. tokens)
27    #[serde(rename = "totalUsage")]
28    pub total_usage: i32,
29    #[serde(rename = "countTraces")]
30    pub count_traces: i32,
31    #[serde(rename = "countObservations")]
32    pub count_observations: i32,
33    /// Total model cost in USD
34    #[serde(rename = "totalCost")]
35    pub total_cost: f64,
36}
37
38impl UsageByModel {
39    /// Daily usage of a given model. Usage corresponds to the unit set for the specific model (e.g. tokens).
40    pub fn new(input_usage: i32, output_usage: i32, total_usage: i32, count_traces: i32, count_observations: i32, total_cost: f64) -> UsageByModel {
41        UsageByModel {
42            model: None,
43            input_usage,
44            output_usage,
45            total_usage,
46            count_traces,
47            count_observations,
48            total_cost,
49        }
50    }
51}
52