langfuse_client/models/
numeric_score.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 NumericScore {
16    /// The numeric value of the score
17    #[serde(rename = "value")]
18    pub value: f64,
19    #[serde(rename = "id")]
20    pub id: String,
21    #[serde(rename = "traceId")]
22    pub trace_id: String,
23    #[serde(rename = "name")]
24    pub name: String,
25    #[serde(rename = "source")]
26    pub source: models::ScoreSource,
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 = "timestamp")]
30    pub timestamp: String,
31    #[serde(rename = "createdAt")]
32    pub created_at: String,
33    #[serde(rename = "updatedAt")]
34    pub updated_at: String,
35    #[serde(rename = "authorUserId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub author_user_id: Option<Option<String>>,
37    #[serde(rename = "comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub comment: Option<Option<String>>,
39    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub metadata: Option<Option<serde_json::Value>>,
41    /// Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range
42    #[serde(rename = "configId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub config_id: Option<Option<String>>,
44    /// Reference an annotation queue on a score. Populated if the score was initially created in an annotation queue.
45    #[serde(rename = "queueId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub queue_id: Option<Option<String>>,
47    /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
48    #[serde(rename = "environment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub environment: Option<Option<String>>,
50}
51
52impl NumericScore {
53    pub fn new(value: f64, id: String, trace_id: String, name: String, source: models::ScoreSource, timestamp: String, created_at: String, updated_at: String) -> NumericScore {
54        NumericScore {
55            value,
56            id,
57            trace_id,
58            name,
59            source,
60            observation_id: None,
61            timestamp,
62            created_at,
63            updated_at,
64            author_user_id: None,
65            comment: None,
66            metadata: None,
67            config_id: None,
68            queue_id: None,
69            environment: None,
70        }
71    }
72}
73