langfuse_client_base/models/score_config.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/// ScoreConfig : Configuration for a score
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
16pub struct ScoreConfig {
17 #[serde(rename = "id")]
18 pub id: String,
19 /// Score config name. Maximum 80 characters.
20 #[serde(rename = "name")]
21 pub name: String,
22 #[serde(rename = "createdAt")]
23 pub created_at: chrono::DateTime<chrono::FixedOffset>,
24 #[serde(rename = "updatedAt")]
25 pub updated_at: chrono::DateTime<chrono::FixedOffset>,
26 #[serde(rename = "projectId")]
27 pub project_id: String,
28 #[serde(rename = "dataType")]
29 pub data_type: models::ScoreConfigDataType,
30 /// Whether the score config is archived. Defaults to false
31 #[serde(rename = "isArchived")]
32 pub is_archived: bool,
33 /// Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞
34 #[serde(
35 rename = "minValue",
36 default,
37 with = "::serde_with::rust::double_option",
38 skip_serializing_if = "Option::is_none"
39 )]
40 pub min_value: Option<Option<f64>>,
41 /// Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞
42 #[serde(
43 rename = "maxValue",
44 default,
45 with = "::serde_with::rust::double_option",
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub max_value: Option<Option<f64>>,
49 /// Configures custom categories for categorical scores
50 #[serde(
51 rename = "categories",
52 default,
53 with = "::serde_with::rust::double_option",
54 skip_serializing_if = "Option::is_none"
55 )]
56 pub categories: Option<Option<Vec<models::ConfigCategory>>>,
57 /// Description of the score config
58 #[serde(
59 rename = "description",
60 default,
61 with = "::serde_with::rust::double_option",
62 skip_serializing_if = "Option::is_none"
63 )]
64 pub description: Option<Option<String>>,
65}
66
67impl ScoreConfig {
68 /// Configuration for a score
69 pub fn new(
70 id: String,
71 name: String,
72 created_at: chrono::DateTime<chrono::FixedOffset>,
73 updated_at: chrono::DateTime<chrono::FixedOffset>,
74 project_id: String,
75 data_type: models::ScoreConfigDataType,
76 is_archived: bool,
77 ) -> ScoreConfig {
78 ScoreConfig {
79 id,
80 name,
81 created_at,
82 updated_at,
83 project_id,
84 data_type,
85 is_archived,
86 min_value: None,
87 max_value: None,
88 categories: None,
89 description: None,
90 }
91 }
92}