langfuse-client-base 0.17.0

Auto-generated Langfuse API client from OpenAPI specification
Documentation
/*
 * server
 *
 * ## 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`
 *
 * The version of the OpenAPI document:
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// PromptVariableMappingSource : Source field used to populate a prompt variable.  Use these values when mapping evaluator prompt variables to live data.  Source semantics: - `input`: the observation input payload - `output`: the observation output payload - `metadata`: the observation metadata object. Combine with `jsonPath` when you need one nested field instead of the whole object. - `tool_calls`: the tool calls recorded on the observation, as an array of `{id, name, arguments, type, index}` objects in the order the model emitted them. Combine with `jsonPath` (for example `$[*].name`) to select parts of each call. - `expected_output`: the experiment item's expected output when the observation belongs to an experiment. - `experiment_item_metadata`: the experiment item's metadata when the observation belongs to an experiment.
/// Source field used to populate a prompt variable.  Use these values when mapping evaluator prompt variables to live data.  Source semantics: - `input`: the observation input payload - `output`: the observation output payload - `metadata`: the observation metadata object. Combine with `jsonPath` when you need one nested field instead of the whole object. - `tool_calls`: the tool calls recorded on the observation, as an array of `{id, name, arguments, type, index}` objects in the order the model emitted them. Combine with `jsonPath` (for example `$[*].name`) to select parts of each call. - `expected_output`: the experiment item's expected output when the observation belongs to an experiment. - `experiment_item_metadata`: the experiment item's metadata when the observation belongs to an experiment.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PromptVariableMappingSource {
    #[serde(rename = "input")]
    Input,
    #[serde(rename = "output")]
    Output,
    #[serde(rename = "metadata")]
    Metadata,
    #[serde(rename = "tool_calls")]
    ToolCalls,
    #[serde(rename = "expected_output")]
    ExpectedOutput,
    #[serde(rename = "experiment_item_metadata")]
    ExperimentItemMetadata,
}

impl std::fmt::Display for PromptVariableMappingSource {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::Input => write!(f, "input"),
            Self::Output => write!(f, "output"),
            Self::Metadata => write!(f, "metadata"),
            Self::ToolCalls => write!(f, "tool_calls"),
            Self::ExpectedOutput => write!(f, "expected_output"),
            Self::ExperimentItemMetadata => write!(f, "experiment_item_metadata"),
        }
    }
}

impl ::std::str::FromStr for PromptVariableMappingSource {
    type Err = crate::models::ParseEnumError;

    fn from_str(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
        match value {
            "input" => Ok(Self::Input),
            "output" => Ok(Self::Output),
            "metadata" => Ok(Self::Metadata),
            "tool_calls" => Ok(Self::ToolCalls),
            "expected_output" => Ok(Self::ExpectedOutput),
            "experiment_item_metadata" => Ok(Self::ExperimentItemMetadata),
            _ => Err(crate::models::ParseEnumError::new(
                "PromptVariableMappingSource",
                value,
            )),
        }
    }
}

impl ::std::convert::TryFrom<&str> for PromptVariableMappingSource {
    type Error = crate::models::ParseEnumError;

    fn try_from(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
        value.parse()
    }
}

impl ::std::convert::TryFrom<&::std::string::String> for PromptVariableMappingSource {
    type Error = crate::models::ParseEnumError;

    fn try_from(
        value: &::std::string::String,
    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
        value.parse()
    }
}

impl ::std::convert::TryFrom<::std::string::String> for PromptVariableMappingSource {
    type Error = crate::models::ParseEnumError;

    fn try_from(
        value: ::std::string::String,
    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
        value.parse()
    }
}