langfuse_client_base/models/
boolean_score_v1.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 BooleanScoreV1 {
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(rename = "traceId")]
25    pub trace_id: String,
26    #[serde(rename = "name")]
27    pub name: String,
28    #[serde(rename = "source")]
29    pub source: models::ScoreSource,
30    #[serde(
31        rename = "observationId",
32        default,
33        with = "::serde_with::rust::double_option",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub observation_id: Option<Option<String>>,
37    #[serde(rename = "timestamp")]
38    pub timestamp: String,
39    #[serde(rename = "createdAt")]
40    pub created_at: String,
41    #[serde(rename = "updatedAt")]
42    pub updated_at: String,
43    #[serde(
44        rename = "authorUserId",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub author_user_id: Option<Option<String>>,
50    #[serde(
51        rename = "comment",
52        default,
53        with = "::serde_with::rust::double_option",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub comment: Option<Option<String>>,
57    #[serde(
58        rename = "metadata",
59        default,
60        with = "::serde_with::rust::double_option",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub metadata: Option<Option<serde_json::Value>>,
64    /// 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
65    #[serde(
66        rename = "configId",
67        default,
68        with = "::serde_with::rust::double_option",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub config_id: Option<Option<String>>,
72    /// Reference an annotation queue on a score. Populated if the score was initially created in an annotation queue.
73    #[serde(
74        rename = "queueId",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub queue_id: Option<Option<String>>,
80    /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
81    #[serde(
82        rename = "environment",
83        default,
84        with = "::serde_with::rust::double_option",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub environment: Option<Option<String>>,
88}
89
90impl BooleanScoreV1 {
91    pub fn new(
92        value: f64,
93        string_value: String,
94        id: String,
95        trace_id: String,
96        name: String,
97        source: models::ScoreSource,
98        timestamp: String,
99        created_at: String,
100        updated_at: String,
101    ) -> BooleanScoreV1 {
102        BooleanScoreV1 {
103            value,
104            string_value,
105            id,
106            trace_id,
107            name,
108            source,
109            observation_id: None,
110            timestamp,
111            created_at,
112            updated_at,
113            author_user_id: None,
114            comment: None,
115            metadata: None,
116            config_id: None,
117            queue_id: None,
118            environment: None,
119        }
120    }
121}