langfuse_client_base/models/boolean_score_v1.rs
1/*
2 * server
3 *
4 * ## Real-time data The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion). ## 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 - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
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, bon::Builder)]
15pub struct BooleanScoreV1 {
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 /// The observation ID associated with the score
25 #[serde(
26 rename = "observationId",
27 default,
28 with = "::serde_with::rust::double_option",
29 skip_serializing_if = "Option::is_none"
30 )]
31 pub observation_id: Option<Option<String>>,
32 #[serde(rename = "timestamp")]
33 pub timestamp: chrono::DateTime<chrono::FixedOffset>,
34 #[serde(rename = "createdAt")]
35 pub created_at: chrono::DateTime<chrono::FixedOffset>,
36 #[serde(rename = "updatedAt")]
37 pub updated_at: chrono::DateTime<chrono::FixedOffset>,
38 /// The user ID of the author
39 #[serde(rename = "authorUserId", deserialize_with = "Option::deserialize")]
40 pub author_user_id: Option<String>,
41 /// Comment on the score
42 #[serde(rename = "comment", deserialize_with = "Option::deserialize")]
43 pub comment: Option<String>,
44 /// Metadata associated with the score
45 #[serde(
46 rename = "metadata",
47 default,
48 with = "::serde_with::rust::double_option",
49 skip_serializing_if = "Option::is_none"
50 )]
51 pub metadata: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
52 /// 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
53 #[serde(rename = "configId", deserialize_with = "Option::deserialize")]
54 pub config_id: Option<String>,
55 /// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
56 #[serde(rename = "queueId", deserialize_with = "Option::deserialize")]
57 pub queue_id: Option<String>,
58 /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
59 #[serde(rename = "environment")]
60 pub environment: String,
61 /// The numeric value of the score. Equals 1 for \"True\" and 0 for \"False\"
62 #[serde(rename = "value")]
63 pub value: f64,
64 /// The string representation of the score value. Is inferred from the numeric value and equals \"True\" or \"False\"
65 #[serde(rename = "stringValue")]
66 pub string_value: String,
67}
68
69impl BooleanScoreV1 {
70 pub fn new(
71 id: String,
72 trace_id: String,
73 name: String,
74 source: models::ScoreSource,
75 timestamp: chrono::DateTime<chrono::FixedOffset>,
76 created_at: chrono::DateTime<chrono::FixedOffset>,
77 updated_at: chrono::DateTime<chrono::FixedOffset>,
78 author_user_id: Option<String>,
79 comment: Option<String>,
80 config_id: Option<String>,
81 queue_id: Option<String>,
82 environment: String,
83 value: f64,
84 string_value: String,
85 ) -> BooleanScoreV1 {
86 BooleanScoreV1 {
87 id,
88 trace_id,
89 name,
90 source,
91 observation_id: None,
92 timestamp,
93 created_at,
94 updated_at,
95 author_user_id,
96 comment,
97 metadata: None,
98 config_id,
99 queue_id,
100 environment,
101 value,
102 string_value,
103 }
104 }
105}