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