Skip to main content

langfuse_client_base/models/
create_score_source.rs

1#![allow(deprecated)]
2/*
3 * server
4 *
5 * ## 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`
6 *
7 * The version of the OpenAPI document:
8 *
9 * Generated by: https://openapi-generator.tech
10 */
11
12use serde::{Deserialize, Serialize};
13
14/// CreateScoreSource : Source values accepted when creating a score via the public REST API. EVAL is reserved for internal evaluator outputs and is intentionally not exposed here — use commons.ScoreSource when reading scores.
15/// Source values accepted when creating a score via the public REST API. EVAL is reserved for internal evaluator outputs and is intentionally not exposed here — use commons.ScoreSource when reading scores.
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum CreateScoreSource {
18    #[serde(rename = "API")]
19    Api,
20    #[serde(rename = "ANNOTATION")]
21    Annotation,
22}
23
24impl std::fmt::Display for CreateScoreSource {
25    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
26        match self {
27            Self::Api => write!(f, "API"),
28            Self::Annotation => write!(f, "ANNOTATION"),
29        }
30    }
31}
32
33impl crate::models::validation::Validate for CreateScoreSource {
34    fn validate_into(
35        &self,
36        _path: &crate::models::validation::Path<'_>,
37        _errors: &mut Vec<crate::models::validation::ValidationError>,
38    ) {
39    }
40}
41
42impl ::std::str::FromStr for CreateScoreSource {
43    type Err = crate::models::ParseEnumError;
44
45    fn from_str(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
46        match value {
47            "API" => Ok(Self::Api),
48            "ANNOTATION" => Ok(Self::Annotation),
49            _ => Err(crate::models::ParseEnumError::new(
50                "CreateScoreSource",
51                value,
52            )),
53        }
54    }
55}
56
57impl ::std::convert::TryFrom<&str> for CreateScoreSource {
58    type Error = crate::models::ParseEnumError;
59
60    fn try_from(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
61        value.parse()
62    }
63}
64
65impl ::std::convert::TryFrom<&::std::string::String> for CreateScoreSource {
66    type Error = crate::models::ParseEnumError;
67
68    fn try_from(
69        value: &::std::string::String,
70    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
71        value.parse()
72    }
73}
74
75impl ::std::convert::TryFrom<::std::string::String> for CreateScoreSource {
76    type Error = crate::models::ParseEnumError;
77
78    fn try_from(
79        value: ::std::string::String,
80    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
81        value.parse()
82    }
83}