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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateEvalCompletionsRunDataSourceSamplingParams {
    #[serde(
        rename = "reasoning_effort",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub reasoning_effort: Option<Option<models::ReasoningEffort>>,
    /// A higher temperature increases randomness in the outputs.
    #[serde(rename = "temperature", skip_serializing_if = "Option::is_none")]
    pub temperature: Option<f64>,
    /// The maximum number of tokens in the generated output.
    #[serde(
        rename = "max_completion_tokens",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_completion_tokens: Option<i32>,
    /// An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
    #[serde(rename = "top_p", skip_serializing_if = "Option::is_none")]
    pub top_p: Option<f64>,
    /// A seed value to initialize the randomness, during sampling.
    #[serde(rename = "seed", skip_serializing_if = "Option::is_none")]
    pub seed: Option<i32>,
    #[serde(rename = "response_format", skip_serializing_if = "Option::is_none")]
    pub response_format:
        Option<Box<models::CreateEvalCompletionsRunDataSourceSamplingParamsResponseFormat>>,
    /// A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
    pub tools: Option<Vec<models::ChatCompletionTool>>,
}

impl CreateEvalCompletionsRunDataSourceSamplingParams {
    pub fn new() -> CreateEvalCompletionsRunDataSourceSamplingParams {
        CreateEvalCompletionsRunDataSourceSamplingParams {
            reasoning_effort: None,
            temperature: None,
            max_completion_tokens: None,
            top_p: None,
            seed: None,
            response_format: None,
            tools: None,
        }
    }
}

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