langfuse-client-base 0.16.1

Auto-generated Langfuse API client from OpenAPI specification
Documentation
/*
 * server
 *
 * ## 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UnstableEvaluatorBase {
    /// Stable identifier of this evaluator across all versions.
    #[serde(rename = "id")]
    pub id: String,
    /// Evaluator name.
    #[serde(rename = "name")]
    pub name: String,
    /// Version number of this evaluator.
    #[serde(rename = "version")]
    pub version: i32,
    /// Variables that can be mapped when creating an evaluation rule.  LLM evaluators require every variable to be mapped exactly once. Code evaluators always expose the fixed runtime payload fields and Langfuse maps them automatically.
    #[serde(rename = "variables")]
    pub variables: Vec<String>,
    /// Default variable mapping for this evaluator version, or `null` when no default is configured.  An entry's `source` is `null` when that variable was never fully configured, and sources are not restricted by rule `target` here, because the default is stored on the evaluator rather than on any one rule.
    #[serde(rename = "mapping", deserialize_with = "Option::deserialize")]
    pub mapping: Option<Vec<models::UnstablePromptVariableMappingRead>>,
    /// Number of evaluation rules in the project that currently use this evaluator.
    #[serde(rename = "evaluationRuleCount")]
    pub evaluation_rule_count: i32,
    /// Timestamp when this evaluator was created.
    #[serde(rename = "createdAt")]
    pub created_at: chrono::DateTime<chrono::FixedOffset>,
    /// Timestamp when this evaluator was last updated.
    #[serde(rename = "updatedAt")]
    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
}

impl UnstableEvaluatorBase {
    pub fn new(
        id: String,
        name: String,
        version: i32,
        variables: Vec<String>,
        mapping: Option<Vec<models::UnstablePromptVariableMappingRead>>,
        evaluation_rule_count: i32,
        created_at: chrono::DateTime<chrono::FixedOffset>,
        updated_at: chrono::DateTime<chrono::FixedOffset>,
    ) -> UnstableEvaluatorBase {
        UnstableEvaluatorBase {
            id,
            name,
            version,
            variables,
            mapping,
            evaluation_rule_count,
            created_at,
            updated_at,
        }
    }
}