langfuse_client_base/models/
score_body.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 ScoreBody {
16    #[serde(
17        rename = "id",
18        default,
19        with = "::serde_with::rust::double_option",
20        skip_serializing_if = "Option::is_none"
21    )]
22    pub id: Option<Option<String>>,
23    #[serde(
24        rename = "traceId",
25        default,
26        with = "::serde_with::rust::double_option",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub trace_id: Option<Option<String>>,
30    #[serde(
31        rename = "sessionId",
32        default,
33        with = "::serde_with::rust::double_option",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub session_id: Option<Option<String>>,
37    #[serde(
38        rename = "observationId",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub observation_id: Option<Option<String>>,
44    #[serde(
45        rename = "datasetRunId",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub dataset_run_id: Option<Option<String>>,
51    #[serde(rename = "name")]
52    pub name: String,
53    #[serde(
54        rename = "environment",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub environment: Option<Option<String>>,
60    #[serde(rename = "value")]
61    pub value: Box<models::CreateScoreValue>,
62    #[serde(
63        rename = "comment",
64        default,
65        with = "::serde_with::rust::double_option",
66        skip_serializing_if = "Option::is_none"
67    )]
68    pub comment: Option<Option<String>>,
69    #[serde(
70        rename = "metadata",
71        default,
72        with = "::serde_with::rust::double_option",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub metadata: Option<Option<serde_json::Value>>,
76    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none")]
77    pub data_type: Option<models::ScoreDataType>,
78    /// Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values
79    #[serde(
80        rename = "configId",
81        default,
82        with = "::serde_with::rust::double_option",
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub config_id: Option<Option<String>>,
86}
87
88impl ScoreBody {
89    pub fn new(name: String, value: models::CreateScoreValue) -> ScoreBody {
90        ScoreBody {
91            id: None,
92            trace_id: None,
93            session_id: None,
94            observation_id: None,
95            dataset_run_id: None,
96            name,
97            environment: None,
98            value: Box::new(value),
99            comment: None,
100            metadata: None,
101            data_type: None,
102            config_id: None,
103        }
104    }
105}