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)]
15#[cfg_attr(feature="bon", derive(bon::Builder))]
16pub struct CreateScoreConfigRequest {
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "dataType")]
20    pub data_type: models::ScoreDataType,
21    /// 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
22    #[serde(rename = "categories", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub categories: Option<Option<Vec<models::ConfigCategory>>>,
24    /// Configure a minimum value for numerical scores. If not set, the minimum value defaults to -∞
25    #[serde(rename = "minValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub min_value: Option<Option<f64>>,
27    /// Configure a maximum value for numerical scores. If not set, the maximum value defaults to +∞
28    #[serde(rename = "maxValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub max_value: Option<Option<f64>>,
30    /// 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
31    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub description: Option<Option<String>>,
33}
34
35impl CreateScoreConfigRequest {
36    pub fn new(name: String, data_type: models::ScoreDataType) -> CreateScoreConfigRequest {
37        CreateScoreConfigRequest {
38            name,
39            data_type,
40            categories: None,
41            min_value: None,
42            max_value: None,
43            description: None,
44        }
45    }
46}
47