openai-client-base 0.12.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// EvalRunOutputItem : A schema representing an evaluation run output item.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct EvalRunOutputItem {
    /// The type of the object. Always \"eval.run.output_item\".
    #[serde(rename = "object")]
    pub object: Object,
    /// Unique identifier for the evaluation run output item.
    #[serde(rename = "id")]
    pub id: String,
    /// The identifier of the evaluation run associated with this output item.
    #[serde(rename = "run_id")]
    pub run_id: String,
    /// The identifier of the evaluation group.
    #[serde(rename = "eval_id")]
    pub eval_id: String,
    /// Unix timestamp (in seconds) when the evaluation run was created.
    #[serde(rename = "created_at")]
    pub created_at: i32,
    /// The status of the evaluation run.
    #[serde(rename = "status")]
    pub status: String,
    /// The identifier for the data source item.
    #[serde(rename = "datasource_item_id")]
    pub datasource_item_id: i32,
    /// Details of the input data source item.
    #[serde(rename = "datasource_item")]
    pub datasource_item: std::collections::HashMap<String, serde_json::Value>,
    /// A list of grader results for this output item.
    #[serde(rename = "results")]
    pub results: Vec<models::EvalRunOutputItemResult>,
    #[serde(rename = "sample")]
    pub sample: Box<models::EvalRunOutputItemSample>,
}

impl EvalRunOutputItem {
    /// A schema representing an evaluation run output item.
    pub fn new(
        object: Object,
        id: String,
        run_id: String,
        eval_id: String,
        created_at: i32,
        status: String,
        datasource_item_id: i32,
        datasource_item: std::collections::HashMap<String, serde_json::Value>,
        results: Vec<models::EvalRunOutputItemResult>,
        sample: models::EvalRunOutputItemSample,
    ) -> EvalRunOutputItem {
        EvalRunOutputItem {
            object,
            id,
            run_id,
            eval_id,
            created_at,
            status,
            datasource_item_id,
            datasource_item,
            results,
            sample: Box::new(sample),
        }
    }
}
/// The type of the object. Always \"eval.run.output_item\".
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
    #[serde(rename = "eval.run.output_item")]
    EvalRunOutputItem,
}

impl Default for Object {
    fn default() -> Object {
        Self::EvalRunOutputItem
    }
}

impl std::fmt::Display for EvalRunOutputItem {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}