langfuse_client_base/models/
score_config.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/// ScoreConfig : Configuration for a score
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ScoreConfig {
17    #[serde(rename = "id")]
18    pub id: String,
19    #[serde(rename = "name")]
20    pub name: String,
21    #[serde(rename = "createdAt")]
22    pub created_at: String,
23    #[serde(rename = "updatedAt")]
24    pub updated_at: String,
25    #[serde(rename = "projectId")]
26    pub project_id: String,
27    #[serde(rename = "dataType")]
28    pub data_type: models::ScoreDataType,
29    /// Whether the score config is archived. Defaults to false
30    #[serde(rename = "isArchived")]
31    pub is_archived: bool,
32    /// Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞
33    #[serde(
34        rename = "minValue",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub min_value: Option<Option<f64>>,
40    /// Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞
41    #[serde(
42        rename = "maxValue",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub max_value: Option<Option<f64>>,
48    /// Configures custom categories for categorical scores
49    #[serde(
50        rename = "categories",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub categories: Option<Option<Vec<models::ConfigCategory>>>,
56    #[serde(
57        rename = "description",
58        default,
59        with = "::serde_with::rust::double_option",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub description: Option<Option<String>>,
63}
64
65impl ScoreConfig {
66    /// Configuration for a score
67    pub fn new(
68        id: String,
69        name: String,
70        created_at: String,
71        updated_at: String,
72        project_id: String,
73        data_type: models::ScoreDataType,
74        is_archived: bool,
75    ) -> ScoreConfig {
76        ScoreConfig {
77            id,
78            name,
79            created_at,
80            updated_at,
81            project_id,
82            data_type,
83            is_archived,
84            min_value: None,
85            max_value: None,
86            categories: None,
87            description: None,
88        }
89    }
90}