langfuse_client/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)]
16#[cfg_attr(feature="bon", derive(bon::Builder))]
17pub struct ScoreConfig {
18    #[serde(rename = "id")]
19    pub id: String,
20    #[serde(rename = "name")]
21    pub name: String,
22    #[serde(rename = "createdAt")]
23    pub created_at: String,
24    #[serde(rename = "updatedAt")]
25    pub updated_at: String,
26    #[serde(rename = "projectId")]
27    pub project_id: String,
28    #[serde(rename = "dataType")]
29    pub data_type: models::ScoreDataType,
30    /// Whether the score config is archived. Defaults to false
31    #[serde(rename = "isArchived")]
32    pub is_archived: bool,
33    /// Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞
34    #[serde(rename = "minValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub min_value: Option<Option<f64>>,
36    /// Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞
37    #[serde(rename = "maxValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub max_value: Option<Option<f64>>,
39    /// Configures custom categories for categorical scores
40    #[serde(rename = "categories", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub categories: Option<Option<Vec<models::ConfigCategory>>>,
42    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub description: Option<Option<String>>,
44}
45
46impl ScoreConfig {
47    /// Configuration for a score
48    pub fn new(id: String, name: String, created_at: String, updated_at: String, project_id: String, data_type: models::ScoreDataType, is_archived: bool) -> ScoreConfig {
49        ScoreConfig {
50            id,
51            name,
52            created_at,
53            updated_at,
54            project_id,
55            data_type,
56            is_archived,
57            min_value: None,
58            max_value: None,
59            categories: None,
60            description: None,
61        }
62    }
63}
64