Skip to main content

langfuse_client_base/models/
legacy_prompt_variable_mapping.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/// LegacyPromptVariableMapping : **Deprecated:** Connects one prompt variable to data from a legacy trace or dataset evaluation rule.  `langfuseObject` selects the object kind. `objectName` separately selects a named observation and is `null` for trace and dataset-item mappings.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
16pub struct LegacyPromptVariableMapping {
17    /// Explicitly marks this as a legacy mapping.
18    #[serde(rename = "mappingType")]
19    pub mapping_type: String,
20    /// Prompt variable name without braces.
21    #[serde(rename = "variable")]
22    pub variable: String,
23    #[serde(rename = "langfuseObject")]
24    pub langfuse_object: models::LegacyEvaluationObject,
25    /// Observation name to match, or `null` when `langfuseObject` is `trace` or `dataset_item`.
26    #[serde(rename = "objectName", deserialize_with = "Option::deserialize")]
27    pub object_name: Option<String>,
28    /// Field selected from the legacy object.
29    #[serde(rename = "source")]
30    pub source: String,
31    /// Optional JSONPath selector applied to the selected field.
32    #[serde(
33        rename = "jsonPath",
34        default,
35        with = "::serde_with::rust::double_option",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub json_path: Option<Option<String>>,
39}
40
41impl LegacyPromptVariableMapping {
42    /// **Deprecated:** Connects one prompt variable to data from a legacy trace or dataset evaluation rule.  `langfuseObject` selects the object kind. `objectName` separately selects a named observation and is `null` for trace and dataset-item mappings.
43    pub fn new(
44        mapping_type: String,
45        variable: String,
46        langfuse_object: models::LegacyEvaluationObject,
47        object_name: Option<String>,
48        source: String,
49    ) -> LegacyPromptVariableMapping {
50        LegacyPromptVariableMapping {
51            mapping_type,
52            variable,
53            langfuse_object,
54            object_name,
55            source,
56            json_path: None,
57        }
58    }
59}