1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* langfuse
*
* ## 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
*
* The version of the OpenAPI document:
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CategoricalScoreV1 {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "traceId")]
pub trace_id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "source")]
pub source: models::ScoreSource,
/// The observation ID associated with the score
#[serde(
rename = "observationId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub observation_id: Option<Option<String>>,
#[serde(rename = "timestamp")]
pub timestamp: String,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "updatedAt")]
pub updated_at: String,
/// The user ID of the author
#[serde(
rename = "authorUserId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub author_user_id: Option<Option<String>>,
/// Comment on the score
#[serde(
rename = "comment",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub comment: Option<Option<String>>,
/// Metadata associated with the score
#[serde(rename = "metadata", deserialize_with = "Option::deserialize")]
pub metadata: Option<serde_json::Value>,
/// 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
#[serde(
rename = "configId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub config_id: Option<Option<String>>,
/// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
#[serde(
rename = "queueId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub queue_id: Option<Option<String>>,
/// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
#[serde(rename = "environment")]
pub environment: String,
/// Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.
#[serde(rename = "value")]
pub value: f64,
/// The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category
#[serde(rename = "stringValue")]
pub string_value: String,
}
impl CategoricalScoreV1 {
pub fn new(
id: String,
trace_id: String,
name: String,
source: models::ScoreSource,
timestamp: String,
created_at: String,
updated_at: String,
metadata: Option<serde_json::Value>,
environment: String,
value: f64,
string_value: String,
) -> CategoricalScoreV1 {
CategoricalScoreV1 {
id,
trace_id,
name,
source,
observation_id: None,
timestamp,
created_at,
updated_at,
author_user_id: None,
comment: None,
metadata,
config_id: None,
queue_id: None,
environment,
value,
string_value,
}
}
}