langfuse_client/models/
create_score_config_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 CreateScoreConfigRequest {
16    #[serde(rename = "name")]
17    pub name: String,
18    #[serde(rename = "dataType")]
19    pub data_type: models::ScoreDataType,
20    /// Configure custom categories for categorical scores. Pass a list of objects with `label` and `value` properties. Categories are autogenerated for boolean configs and cannot be passed
21    #[serde(rename = "categories", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub categories: Option<Option<Vec<models::ConfigCategory>>>,
23    /// Configure a minimum value for numerical scores. If not set, the minimum value defaults to -∞
24    #[serde(rename = "minValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub min_value: Option<Option<f64>>,
26    /// Configure a maximum value for numerical scores. If not set, the maximum value defaults to +∞
27    #[serde(rename = "maxValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub max_value: Option<Option<f64>>,
29    /// Description is shown across the Langfuse UI and can be used to e.g. explain the config categories in detail, why a numeric range was set, or provide additional context on config name or usage
30    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub description: Option<Option<String>>,
32}
33
34impl CreateScoreConfigRequest {
35    pub fn new(name: String, data_type: models::ScoreDataType) -> CreateScoreConfigRequest {
36        CreateScoreConfigRequest {
37            name,
38            data_type,
39            categories: None,
40            min_value: None,
41            max_value: None,
42            description: None,
43        }
44    }
45}
46