langfuse_rs/models/
open_ai_usage_schema.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OpenAiUsageSchema {
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(
23		rename = "prompt_tokens_details",
24		default,
25		with = "::serde_with::rust::double_option",
26		skip_serializing_if = "Option::is_none"
27	)]
28	pub prompt_tokens_details: Option<Option<std::collections::HashMap<String, i32>>>,
29	#[serde(
30		rename = "completion_tokens_details",
31		default,
32		with = "::serde_with::rust::double_option",
33		skip_serializing_if = "Option::is_none"
34	)]
35	pub completion_tokens_details: Option<Option<std::collections::HashMap<String, i32>>>,
36}
37
38impl OpenAiUsageSchema {
39	pub fn new(prompt_tokens: i32, completion_tokens: i32, total_tokens: i32) -> OpenAiUsageSchema {
40		OpenAiUsageSchema {
41			prompt_tokens,
42			completion_tokens,
43			total_tokens,
44			prompt_tokens_details: None,
45			completion_tokens_details: None,
46		}
47	}
48}