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)]
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(rename = "minValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub min_value: Option<Option<f64>>,
35    /// Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞
36    #[serde(rename = "maxValue", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub max_value: Option<Option<f64>>,
38    /// Configures custom categories for categorical scores
39    #[serde(rename = "categories", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub categories: Option<Option<Vec<models::ConfigCategory>>>,
41    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
42    pub description: Option<Option<String>>,
43}
44
45impl ScoreConfig {
46    /// Configuration for a score
47    pub fn new(id: String, name: String, created_at: String, updated_at: String, project_id: String, data_type: models::ScoreDataType, is_archived: bool) -> ScoreConfig {
48        ScoreConfig {
49            id,
50            name,
51            created_at,
52            updated_at,
53            project_id,
54            data_type,
55            is_archived,
56            min_value: None,
57            max_value: None,
58            categories: None,
59            description: None,
60        }
61    }
62}
63