langfuse_client_base/models/
boolean_score.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, bon::Builder)]
15pub struct BooleanScore {
16    #[serde(rename = "id")]
17    pub id: String,
18    #[serde(
19        rename = "traceId",
20        default,
21        with = "::serde_with::rust::double_option",
22        skip_serializing_if = "Option::is_none"
23    )]
24    pub trace_id: Option<Option<String>>,
25    #[serde(
26        rename = "sessionId",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub session_id: Option<Option<String>>,
32    #[serde(
33        rename = "observationId",
34        default,
35        with = "::serde_with::rust::double_option",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub observation_id: Option<Option<String>>,
39    #[serde(
40        rename = "datasetRunId",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub dataset_run_id: Option<Option<String>>,
46    #[serde(rename = "name")]
47    pub name: String,
48    #[serde(rename = "source")]
49    pub source: models::ScoreSource,
50    #[serde(rename = "timestamp")]
51    pub timestamp: String,
52    #[serde(rename = "createdAt")]
53    pub created_at: String,
54    #[serde(rename = "updatedAt")]
55    pub updated_at: String,
56    #[serde(
57        rename = "authorUserId",
58        default,
59        with = "::serde_with::rust::double_option",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub author_user_id: Option<Option<String>>,
63    #[serde(
64        rename = "comment",
65        default,
66        with = "::serde_with::rust::double_option",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub comment: Option<Option<String>>,
70    #[serde(
71        rename = "metadata",
72        default,
73        with = "::serde_with::rust::double_option",
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub metadata: Option<Option<serde_json::Value>>,
77    /// Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range
78    #[serde(
79        rename = "configId",
80        default,
81        with = "::serde_with::rust::double_option",
82        skip_serializing_if = "Option::is_none"
83    )]
84    pub config_id: Option<Option<String>>,
85    /// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
86    #[serde(
87        rename = "queueId",
88        default,
89        with = "::serde_with::rust::double_option",
90        skip_serializing_if = "Option::is_none"
91    )]
92    pub queue_id: Option<Option<String>>,
93    /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
94    #[serde(
95        rename = "environment",
96        default,
97        with = "::serde_with::rust::double_option",
98        skip_serializing_if = "Option::is_none"
99    )]
100    pub environment: Option<Option<String>>,
101    /// The numeric value of the score. Equals 1 for \"True\" and 0 for \"False\"
102    #[serde(rename = "value")]
103    pub value: f64,
104    /// The string representation of the score value. Is inferred from the numeric value and equals \"True\" or \"False\"
105    #[serde(rename = "stringValue")]
106    pub string_value: String,
107}
108
109impl BooleanScore {
110    pub fn new(
111        id: String,
112        name: String,
113        source: models::ScoreSource,
114        timestamp: String,
115        created_at: String,
116        updated_at: String,
117        value: f64,
118        string_value: String,
119    ) -> BooleanScore {
120        BooleanScore {
121            id,
122            trace_id: None,
123            session_id: None,
124            observation_id: None,
125            dataset_run_id: None,
126            name,
127            source,
128            timestamp,
129            created_at,
130            updated_at,
131            author_user_id: None,
132            comment: None,
133            metadata: None,
134            config_id: None,
135            queue_id: None,
136            environment: None,
137            value,
138            string_value,
139        }
140    }
141}