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)]
15pub struct CreateScoreRequest {
16    #[serde(rename = "id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub id: Option<Option<String>>,
18    #[serde(rename = "traceId")]
19    pub trace_id: String,
20    #[serde(rename = "name")]
21    pub name: String,
22    #[serde(rename = "value")]
23    pub value: models::CreateScoreValue,
24    #[serde(rename = "observationId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub observation_id: Option<Option<String>>,
26    #[serde(rename = "comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub comment: Option<Option<String>>,
28    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub metadata: Option<Option<serde_json::Value>>,
30    /// The environment of the score. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
31    #[serde(rename = "environment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub environment: Option<Option<String>>,
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. The unique langfuse identifier of a score config. When passing this field, the dataType and stringValue fields are automatically populated.
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 CreateScoreRequest {
41    pub fn new(trace_id: String, name: String, value: models::CreateScoreValue) -> CreateScoreRequest {
42        CreateScoreRequest {
43            id: None,
44            trace_id,
45            name,
46            value,
47            observation_id: None,
48            comment: None,
49            metadata: None,
50            environment: None,
51            data_type: None,
52            config_id: None,
53        }
54    }
55}
56