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

/// ChatSessionChatkitConfiguration : ChatKit configuration for the session.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ChatSessionChatkitConfiguration {
    #[serde(rename = "automatic_thread_titling")]
    pub automatic_thread_titling: Box<models::ChatSessionAutomaticThreadTitling>,
    #[serde(rename = "file_upload")]
    pub file_upload: Box<models::ChatSessionFileUpload>,
    #[serde(rename = "history")]
    pub history: Box<models::ChatSessionHistory>,
}

impl ChatSessionChatkitConfiguration {
    /// ChatKit configuration for the session.
    pub fn new(
        automatic_thread_titling: models::ChatSessionAutomaticThreadTitling,
        file_upload: models::ChatSessionFileUpload,
        history: models::ChatSessionHistory,
    ) -> ChatSessionChatkitConfiguration {
        ChatSessionChatkitConfiguration {
            automatic_thread_titling: Box::new(automatic_thread_titling),
            file_upload: Box::new(file_upload),
            history: Box::new(history),
        }
    }
}

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