langfuse-client-base 0.12.0

Auto-generated Langfuse API client from OpenAPI specification
Documentation
/*
 * langfuse
 *
 * ## 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
 *
 * 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 GetScoresResponseDataText {
    #[serde(rename = "id")]
    pub id: String,
    /// The trace ID associated with the score
    #[serde(
        rename = "traceId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub trace_id: Option<Option<String>>,
    /// The session ID associated with the score
    #[serde(
        rename = "sessionId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub session_id: Option<Option<String>>,
    /// The observation ID associated with the score
    #[serde(
        rename = "observationId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub observation_id: Option<Option<String>>,
    /// The dataset run ID associated with the score
    #[serde(
        rename = "datasetRunId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub dataset_run_id: Option<Option<String>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "source")]
    pub source: models::ScoreSource,
    #[serde(rename = "timestamp")]
    pub timestamp: String,
    #[serde(rename = "createdAt")]
    pub created_at: String,
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// The user ID of the author
    #[serde(
        rename = "authorUserId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub author_user_id: Option<Option<String>>,
    /// Comment on the score
    #[serde(
        rename = "comment",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub comment: Option<Option<String>>,
    /// Metadata associated with the score
    #[serde(rename = "metadata", deserialize_with = "Option::deserialize")]
    pub metadata: Option<serde_json::Value>,
    /// Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range
    #[serde(
        rename = "configId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub config_id: Option<Option<String>>,
    /// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
    #[serde(
        rename = "queueId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub queue_id: Option<Option<String>>,
    /// The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
    #[serde(rename = "environment")]
    pub environment: String,
    /// The text content of the score (1-500 characters)
    #[serde(rename = "stringValue")]
    pub string_value: String,
    #[serde(rename = "trace", skip_serializing_if = "Option::is_none")]
    pub trace: Option<Box<models::GetScoresResponseTraceData>>,
}

impl GetScoresResponseDataText {
    pub fn new(
        id: String,
        name: String,
        source: models::ScoreSource,
        timestamp: String,
        created_at: String,
        updated_at: String,
        metadata: Option<serde_json::Value>,
        environment: String,
        string_value: String,
    ) -> GetScoresResponseDataText {
        GetScoresResponseDataText {
            id,
            trace_id: None,
            session_id: None,
            observation_id: None,
            dataset_run_id: None,
            name,
            source,
            timestamp,
            created_at,
            updated_at,
            author_user_id: None,
            comment: None,
            metadata,
            config_id: None,
            queue_id: None,
            environment,
            string_value,
            trace: None,
        }
    }
}