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