langfuse_client_base/models/
create_model_request.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 CreateModelRequest {
16    /// Name of the model definition. If multiple with the same name exist, they are applied in the following order: (1) custom over built-in, (2) newest according to startTime where model.startTime<observation.startTime
17    #[serde(rename = "modelName")]
18    pub model_name: String,
19    /// Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$`
20    #[serde(rename = "matchPattern")]
21    pub match_pattern: String,
22    /// Apply only to generations which are newer than this ISO date.
23    #[serde(
24        rename = "startDate",
25        default,
26        with = "::serde_with::rust::double_option",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub start_date: Option<Option<String>>,
30    #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
31    pub unit: Option<models::ModelUsageUnit>,
32    /// Price (USD) per input unit
33    #[serde(
34        rename = "inputPrice",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub input_price: Option<Option<f64>>,
40    /// Price (USD) per output unit
41    #[serde(
42        rename = "outputPrice",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub output_price: Option<Option<f64>>,
48    /// Price (USD) per total units. Cannot be set if input or output price is set.
49    #[serde(
50        rename = "totalPrice",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub total_price: Option<Option<f64>>,
56    /// Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
57    #[serde(
58        rename = "tokenizerId",
59        default,
60        with = "::serde_with::rust::double_option",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub tokenizer_id: Option<Option<String>>,
64    /// Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
65    #[serde(
66        rename = "tokenizerConfig",
67        default,
68        with = "::serde_with::rust::double_option",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub tokenizer_config: Option<Option<serde_json::Value>>,
72}
73
74impl CreateModelRequest {
75    pub fn new(model_name: String, match_pattern: String) -> CreateModelRequest {
76        CreateModelRequest {
77            model_name,
78            match_pattern,
79            start_date: None,
80            unit: None,
81            input_price: None,
82            output_price: None,
83            total_price: None,
84            tokenizer_id: None,
85            tokenizer_config: None,
86        }
87    }
88}