langfuse_client/models/
score_body.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)]
15#[cfg_attr(feature="bon", derive(bon::Builder))]
16pub struct ScoreBody {
17    #[serde(rename = "id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
18    pub id: Option<Option<String>>,
19    #[serde(rename = "traceId")]
20    pub trace_id: String,
21    #[serde(rename = "name")]
22    pub name: String,
23    #[serde(rename = "environment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub environment: Option<Option<String>>,
25    #[serde(rename = "value")]
26    pub value: models::CreateScoreValue,
27    #[serde(rename = "observationId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub observation_id: Option<Option<String>>,
29    #[serde(rename = "comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub comment: Option<Option<String>>,
31    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub metadata: Option<Option<serde_json::Value>>,
33    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none")]
34    pub data_type: Option<models::ScoreDataType>,
35    /// Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values
36    #[serde(rename = "configId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub config_id: Option<Option<String>>,
38}
39
40impl ScoreBody {
41    pub fn new(trace_id: String, name: String, value: models::CreateScoreValue) -> ScoreBody {
42        ScoreBody {
43            id: None,
44            trace_id,
45            name,
46            environment: None,
47            value,
48            observation_id: None,
49            comment: None,
50            metadata: None,
51            data_type: None,
52            config_id: None,
53        }
54    }
55}
56