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