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

/// GraderScoreModelSamplingParams : The sampling parameters for the model.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct GraderScoreModelSamplingParams {
    /// A seed value to initialize the randomness, during sampling.
    #[serde(
        rename = "seed",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub seed: Option<Option<i32>>,
    /// An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
    #[serde(
        rename = "top_p",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub top_p: Option<Option<f64>>,
    /// A higher temperature increases randomness in the outputs.
    #[serde(
        rename = "temperature",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub temperature: Option<Option<f64>>,
    /// The maximum number of tokens the grader model may generate in its response.
    #[serde(
        rename = "max_completions_tokens",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_completions_tokens: Option<Option<i32>>,
    #[serde(
        rename = "reasoning_effort",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub reasoning_effort: Option<Option<models::ReasoningEffort>>,
}

impl GraderScoreModelSamplingParams {
    /// The sampling parameters for the model.
    pub fn new() -> GraderScoreModelSamplingParams {
        GraderScoreModelSamplingParams {
            seed: None,
            top_p: None,
            temperature: None,
            max_completions_tokens: None,
            reasoning_effort: None,
        }
    }
}

impl std::fmt::Display for GraderScoreModelSamplingParams {
    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),
        }
    }
}