langfuse_rs/models/
create_score_request.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 CreateScoreRequest {
16	#[serde(
17		rename = "id",
18		default,
19		with = "::serde_with::rust::double_option",
20		skip_serializing_if = "Option::is_none"
21	)]
22	pub id: Option<Option<String>>,
23	#[serde(rename = "traceId")]
24	pub trace_id: String,
25	#[serde(rename = "name")]
26	pub name: String,
27	#[serde(rename = "value")]
28	pub value: Box<models::CreateScoreValue>,
29	#[serde(
30		rename = "observationId",
31		default,
32		with = "::serde_with::rust::double_option",
33		skip_serializing_if = "Option::is_none"
34	)]
35	pub observation_id: Option<Option<String>>,
36	#[serde(
37		rename = "comment",
38		default,
39		with = "::serde_with::rust::double_option",
40		skip_serializing_if = "Option::is_none"
41	)]
42	pub comment: Option<Option<String>>,
43	#[serde(rename = "dataType", skip_serializing_if = "Option::is_none")]
44	pub data_type: Option<models::ScoreDataType>,
45	/// Reference a score config on a score. The unique langfuse identifier of a score config. When passing this field, the dataType and stringValue fields are automatically populated.
46	#[serde(
47		rename = "configId",
48		default,
49		with = "::serde_with::rust::double_option",
50		skip_serializing_if = "Option::is_none"
51	)]
52	pub config_id: Option<Option<String>>,
53}
54
55impl CreateScoreRequest {
56	pub fn new(trace_id: String, name: String, value: models::CreateScoreValue) -> CreateScoreRequest {
57		CreateScoreRequest {
58			id: None,
59			trace_id,
60			name,
61			value: Box::new(value),
62			observation_id: None,
63			comment: None,
64			data_type: None,
65			config_id: None,
66		}
67	}
68}