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