/*
* 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};
/// UnstableEvaluationRuleBase : Live evaluation rule for incoming data. An evaluation rule answers: - which evaluator should be used - which target objects should trigger scoring - how often scoring should run - which target fields should populate each prompt variable - whether the deployment is active, inactive, or paused Important status semantics: - `enabled` is the desired on/off setting from the client - `status` is the effective runtime state after Langfuse applies validation and blocking rules - `enabled=true` with `status=paused` means the rule should run, but Langfuse has paused it until the underlying problem is fixed
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct UnstableEvaluationRuleBase {
/// Stable evaluation rule identifier.
#[serde(rename = "id")]
pub id: String,
/// Human-readable deployment name. This is independent from the evaluator name.
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "evaluator")]
pub evaluator: Box<models::UnstableEvaluationRuleEvaluator>,
/// Desired enabled state configured by the client.
#[serde(rename = "enabled")]
pub enabled: bool,
#[serde(rename = "status")]
pub status: models::UnstableEvaluationRuleStatus,
/// Machine-readable reason when `status=paused`, otherwise `null`.
#[serde(rename = "pausedReason", deserialize_with = "Option::deserialize")]
pub paused_reason: Option<String>,
/// Human-readable explanation when `status=paused`, otherwise `null`.
#[serde(rename = "pausedMessage", deserialize_with = "Option::deserialize")]
pub paused_message: Option<String>,
/// Fraction of matching target objects that should be evaluated. Must be greater than `0` and less than or equal to `1`. - `1` means evaluate every matching target. - `0.25` means evaluate approximately 25% of matching targets.
#[serde(rename = "sampling")]
pub sampling: f64,
/// Timestamp when the evaluation rule was created.
#[serde(rename = "createdAt")]
pub created_at: chrono::DateTime<chrono::FixedOffset>,
/// Timestamp when the evaluation rule was last updated.
#[serde(rename = "updatedAt")]
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
}
impl UnstableEvaluationRuleBase {
/// Live evaluation rule for incoming data. An evaluation rule answers: - which evaluator should be used - which target objects should trigger scoring - how often scoring should run - which target fields should populate each prompt variable - whether the deployment is active, inactive, or paused Important status semantics: - `enabled` is the desired on/off setting from the client - `status` is the effective runtime state after Langfuse applies validation and blocking rules - `enabled=true` with `status=paused` means the rule should run, but Langfuse has paused it until the underlying problem is fixed
pub fn new(
id: String,
name: String,
evaluator: models::UnstableEvaluationRuleEvaluator,
enabled: bool,
status: models::UnstableEvaluationRuleStatus,
paused_reason: Option<String>,
paused_message: Option<String>,
sampling: f64,
created_at: chrono::DateTime<chrono::FixedOffset>,
updated_at: chrono::DateTime<chrono::FixedOffset>,
) -> UnstableEvaluationRuleBase {
UnstableEvaluationRuleBase {
id,
name,
evaluator: Box::new(evaluator),
enabled,
status,
paused_reason,
paused_message,
sampling,
created_at,
updated_at,
}
}
}