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(rename = "metadata")]
46 pub metadata: std::collections::HashMap<String, serde_json::Value>,
47 /// 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
48 #[serde(rename = "configId", deserialize_with = "Option::deserialize")]
49 pub config_id: Option<String>,
50 /// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
51 #[serde(rename = "queueId", deserialize_with = "Option::deserialize")]
52 pub queue_id: Option<String>,
53 /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
54 #[serde(rename = "environment")]
55 pub environment: String,
56 /// The numeric value of the score. Equals 1 for \"True\" and 0 for \"False\"
57 #[serde(rename = "value")]
58 pub value: f64,
59 /// The string representation of the score value. Is inferred from the numeric value and equals \"True\" or \"False\"
60 #[serde(rename = "stringValue")]
61 pub string_value: String,
62}
63
64impl BooleanScoreV1 {
65 pub fn new(
66 id: String,
67 trace_id: String,
68 name: String,
69 source: models::ScoreSource,
70 timestamp: chrono::DateTime<chrono::FixedOffset>,
71 created_at: chrono::DateTime<chrono::FixedOffset>,
72 updated_at: chrono::DateTime<chrono::FixedOffset>,
73 author_user_id: Option<String>,
74 comment: Option<String>,
75 metadata: std::collections::HashMap<String, serde_json::Value>,
76 config_id: Option<String>,
77 queue_id: Option<String>,
78 environment: String,
79 value: f64,
80 string_value: String,
81 ) -> BooleanScoreV1 {
82 BooleanScoreV1 {
83 id,
84 trace_id,
85 name,
86 source,
87 observation_id: None,
88 timestamp,
89 created_at,
90 updated_at,
91 author_user_id,
92 comment,
93 metadata,
94 config_id,
95 queue_id,
96 environment,
97 value,
98 string_value,
99 }
100 }
101}