langfuse_rs/models/
base_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)]
15pub struct BaseScore {
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	/// 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
52	#[serde(
53		rename = "configId",
54		default,
55		with = "::serde_with::rust::double_option",
56		skip_serializing_if = "Option::is_none"
57	)]
58	pub config_id: Option<Option<String>>,
59	/// Reference an annotation queue on a score. Populated if the score was initially created in an annotation queue.
60	#[serde(
61		rename = "queueId",
62		default,
63		with = "::serde_with::rust::double_option",
64		skip_serializing_if = "Option::is_none"
65	)]
66	pub queue_id: Option<Option<String>>,
67}
68
69impl BaseScore {
70	pub fn new(
71		id: String,
72		trace_id: String,
73		name: String,
74		source: models::ScoreSource,
75		timestamp: String,
76		created_at: String,
77		updated_at: String,
78	) -> BaseScore {
79		BaseScore {
80			id,
81			trace_id,
82			name,
83			source,
84			observation_id: None,
85			timestamp,
86			created_at,
87			updated_at,
88			author_user_id: None,
89			comment: None,
90			config_id: None,
91			queue_id: None,
92		}
93	}
94}