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