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