langfuse-client-base 0.15.0

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};

/// UnstableUpdateEvaluationRuleRequest : Partial update body for an evaluation rule.  Provide only the fields you want to change. An empty body is rejected.  Practical guidance: - If you only want to rename the rule or change sampling, send just those fields. - To add, remove, or remap evaluators, send `evaluators`. It replaces the whole assignment set, so include every evaluator the rule should keep. - `evaluators` cannot be combined with the deprecated `evaluator`/`mapping` pair, which only ever addressed the first assignment. - If you change to an LLM-as-judge `evaluator`, send a fresh `mapping` unless you are certain the existing mapping still matches the prompt variables. - If you change `target` for an LLM-as-judge rule, usually send both `filter` and `mapping` in the same request. - For code evaluator rules, omit `mapping`; Langfuse stores the fixed code runtime mapping automatically. - If you change an experiment `datasetId` filter, call `GET /api/public/v2/datasets` and use dataset `id` values from that response.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UnstableUpdateEvaluationRuleRequest {
    /// Updated deployment name.
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
    /// Full replacement of the rule's evaluator assignments: entries that are not listed are detached.  Mutually exclusive with the deprecated `evaluator` and `mapping` fields.
    #[serde(
        rename = "evaluators",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub evaluators: Option<Option<Vec<models::UnstableCreateEvaluationRuleEvaluatorAssignment>>>,
    #[serde(rename = "evaluator", skip_serializing_if = "Option::is_none")]
    pub evaluator: Option<Box<models::UnstableEvaluationRuleEvaluatorReference>>,
    #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
    pub target: Option<models::UnstableEvaluationRuleTarget>,
    /// Updated desired enabled state.
    #[serde(
        rename = "enabled",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub enabled: Option<Option<bool>>,
    /// Updated sampling fraction.
    #[serde(
        rename = "sampling",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub sampling: Option<Option<f64>>,
    /// Updated filter list.  For `target=experiment`, `column=datasetId` expects dataset `id` values from `GET /api/public/v2/datasets`, not dataset names.
    #[serde(
        rename = "filter",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub filter: Option<Option<Vec<models::UnstableEvaluationRuleFilter>>>,
    /// Updated LLM-as-judge variable mappings.  Do not send this field for code evaluator rules. Langfuse stores the fixed code runtime mapping automatically and returns it in the response.
    #[serde(
        rename = "mapping",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub mapping: Option<Option<Vec<models::UnstablePromptVariableMappingInput>>>,
}

impl UnstableUpdateEvaluationRuleRequest {
    /// Partial update body for an evaluation rule.  Provide only the fields you want to change. An empty body is rejected.  Practical guidance: - If you only want to rename the rule or change sampling, send just those fields. - To add, remove, or remap evaluators, send `evaluators`. It replaces the whole assignment set, so include every evaluator the rule should keep. - `evaluators` cannot be combined with the deprecated `evaluator`/`mapping` pair, which only ever addressed the first assignment. - If you change to an LLM-as-judge `evaluator`, send a fresh `mapping` unless you are certain the existing mapping still matches the prompt variables. - If you change `target` for an LLM-as-judge rule, usually send both `filter` and `mapping` in the same request. - For code evaluator rules, omit `mapping`; Langfuse stores the fixed code runtime mapping automatically. - If you change an experiment `datasetId` filter, call `GET /api/public/v2/datasets` and use dataset `id` values from that response.
    pub fn new() -> UnstableUpdateEvaluationRuleRequest {
        UnstableUpdateEvaluationRuleRequest {
            name: None,
            evaluators: None,
            evaluator: None,
            target: None,
            enabled: None,
            sampling: None,
            filter: None,
            mapping: None,
        }
    }
}