langfuse_client_base/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, bon::Builder)]
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(
24        rename = "traceId",
25        default,
26        with = "::serde_with::rust::double_option",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub trace_id: Option<Option<String>>,
30    #[serde(
31        rename = "sessionId",
32        default,
33        with = "::serde_with::rust::double_option",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub session_id: Option<Option<String>>,
37    #[serde(
38        rename = "observationId",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub observation_id: Option<Option<String>>,
44    #[serde(
45        rename = "datasetRunId",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub dataset_run_id: Option<Option<String>>,
51    #[serde(rename = "name")]
52    pub name: String,
53    #[serde(rename = "value")]
54    pub value: Box<models::CreateScoreValue>,
55    #[serde(
56        rename = "comment",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub comment: Option<Option<String>>,
62    #[serde(
63        rename = "metadata",
64        default,
65        with = "::serde_with::rust::double_option",
66        skip_serializing_if = "Option::is_none"
67    )]
68    pub metadata: Option<Option<serde_json::Value>>,
69    /// The environment of the score. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
70    #[serde(
71        rename = "environment",
72        default,
73        with = "::serde_with::rust::double_option",
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub environment: Option<Option<String>>,
77    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none")]
78    pub data_type: Option<models::ScoreDataType>,
79    /// 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.
80    #[serde(
81        rename = "configId",
82        default,
83        with = "::serde_with::rust::double_option",
84        skip_serializing_if = "Option::is_none"
85    )]
86    pub config_id: Option<Option<String>>,
87}
88
89impl CreateScoreRequest {
90    pub fn new(name: String, value: models::CreateScoreValue) -> CreateScoreRequest {
91        CreateScoreRequest {
92            id: None,
93            trace_id: None,
94            session_id: None,
95            observation_id: None,
96            dataset_run_id: None,
97            name,
98            value: Box::new(value),
99            comment: None,
100            metadata: None,
101            environment: None,
102            data_type: None,
103            config_id: None,
104        }
105    }
106}