langfuse_client/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)]
15#[cfg_attr(feature="bon", derive(bon::Builder))]
16pub struct CreateScoreRequest {
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 = "value")]
24    pub value: models::CreateScoreValue,
25    #[serde(rename = "observationId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub observation_id: Option<Option<String>>,
27    #[serde(rename = "comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub comment: Option<Option<String>>,
29    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub metadata: Option<Option<serde_json::Value>>,
31    /// The environment of the score. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
32    #[serde(rename = "environment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub environment: Option<Option<String>>,
34    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none")]
35    pub data_type: Option<models::ScoreDataType>,
36    /// 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.
37    #[serde(rename = "configId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub config_id: Option<Option<String>>,
39}
40
41impl CreateScoreRequest {
42    pub fn new(trace_id: String, name: String, value: models::CreateScoreValue) -> CreateScoreRequest {
43        CreateScoreRequest {
44            id: None,
45            trace_id,
46            name,
47            value,
48            observation_id: None,
49            comment: None,
50            metadata: None,
51            environment: None,
52            data_type: None,
53            config_id: None,
54        }
55    }
56}
57