langfuse_client_base/models/
base_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 BaseScoreV1 {
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    /// Reference an annotation queue on a score. Populated if the score was initially created in an 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}
83
84impl BaseScoreV1 {
85    pub fn new(
86        id: String,
87        trace_id: String,
88        name: String,
89        source: models::ScoreSource,
90        timestamp: String,
91        created_at: String,
92        updated_at: String,
93    ) -> BaseScoreV1 {
94        BaseScoreV1 {
95            id,
96            trace_id,
97            name,
98            source,
99            observation_id: None,
100            timestamp,
101            created_at,
102            updated_at,
103            author_user_id: None,
104            comment: None,
105            metadata: None,
106            config_id: None,
107            queue_id: None,
108            environment: None,
109        }
110    }
111}