langfuse_client/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(rename = "startDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub start_date: Option<Option<String>>,
25    #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
26    pub unit: Option<models::ModelUsageUnit>,
27    /// Price (USD) per input unit
28    #[serde(rename = "inputPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub input_price: Option<Option<f64>>,
30    /// Price (USD) per output unit
31    #[serde(rename = "outputPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub output_price: Option<Option<f64>>,
33    /// Price (USD) per total units. Cannot be set if input or output price is set.
34    #[serde(rename = "totalPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub total_price: Option<Option<f64>>,
36    /// Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
37    #[serde(rename = "tokenizerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub tokenizer_id: Option<Option<String>>,
39    /// Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
40    #[serde(rename = "tokenizerConfig", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub tokenizer_config: Option<Option<serde_json::Value>>,
42}
43
44impl CreateModelRequest {
45    pub fn new(model_name: String, match_pattern: String) -> CreateModelRequest {
46        CreateModelRequest {
47            model_name,
48            match_pattern,
49            start_date: None,
50            unit: None,
51            input_price: None,
52            output_price: None,
53            total_price: None,
54            tokenizer_id: None,
55            tokenizer_config: None,
56        }
57    }
58}
59