langfuse-client 0.1.22

## 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
Documentation
/*
 * langfuse
 *
 * ## 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
 *
 * The version of the OpenAPI document: 
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Model : Model definition used for transforming usage into USD cost and/or tokenization.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature="bon", derive(bon::Builder))]
pub struct Model {
    #[serde(rename = "id")]
    pub id: String,
    /// 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
    #[serde(rename = "modelName")]
    pub model_name: String,
    /// 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$`
    #[serde(rename = "matchPattern")]
    pub match_pattern: String,
    /// Apply only to generations which are newer than this ISO date.
    #[serde(rename = "startDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub start_date: Option<Option<String>>,
    #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
    pub unit: Option<models::ModelUsageUnit>,
    /// Price (USD) per input unit
    #[serde(rename = "inputPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub input_price: Option<Option<f64>>,
    /// Price (USD) per output unit
    #[serde(rename = "outputPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub output_price: Option<Option<f64>>,
    /// Price (USD) per total unit. Cannot be set if input or output price is set.
    #[serde(rename = "totalPrice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub total_price: Option<Option<f64>>,
    /// Optional. Tokenizer to be applied to observations which match to this model. See docs for more details.
    #[serde(rename = "tokenizerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tokenizer_id: Option<Option<String>>,
    /// Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details.
    #[serde(rename = "tokenizerConfig", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tokenizer_config: Option<Option<serde_json::Value>>,
    #[serde(rename = "isLangfuseManaged")]
    pub is_langfuse_managed: bool,
}

impl Model {
    /// Model definition used for transforming usage into USD cost and/or tokenization.
    pub fn new(id: String, model_name: String, match_pattern: String, is_langfuse_managed: bool) -> Model {
        Model {
            id,
            model_name,
            match_pattern,
            start_date: None,
            unit: None,
            input_price: None,
            output_price: None,
            total_price: None,
            tokenizer_id: None,
            tokenizer_config: None,
            is_langfuse_managed,
        }
    }
}