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

/// RealtimeTranscriptionSessionCreateResponseGa : A Realtime transcription session configuration object.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct RealtimeTranscriptionSessionCreateResponseGa {
    /// The type of session. Always `transcription` for transcription sessions.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Unique identifier for the session that looks like `sess_1234567890abcdef`.
    #[serde(rename = "id")]
    pub id: String,
    /// The object type. Always `realtime.transcription_session`.
    #[serde(rename = "object")]
    pub object: String,
    /// Expiration timestamp for the session, in seconds since epoch.
    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<i32>,
    /// Additional fields to include in server outputs. - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
    #[serde(rename = "include", skip_serializing_if = "Option::is_none")]
    pub include: Option<Vec<Include>>,
    #[serde(rename = "audio", skip_serializing_if = "Option::is_none")]
    pub audio: Option<Box<models::RealtimeTranscriptionSessionCreateResponseGaAudio>>,
}

impl RealtimeTranscriptionSessionCreateResponseGa {
    /// A Realtime transcription session configuration object.
    pub fn new(
        r#type: Type,
        id: String,
        object: String,
    ) -> RealtimeTranscriptionSessionCreateResponseGa {
        RealtimeTranscriptionSessionCreateResponseGa {
            r#type,
            id,
            object,
            expires_at: None,
            include: None,
            audio: None,
        }
    }
}
/// The type of session. Always `transcription` for transcription sessions.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "transcription")]
    Transcription,
}

impl Default for Type {
    fn default() -> Type {
        Self::Transcription
    }
}
/// Additional fields to include in server outputs. - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Include {
    #[serde(rename = "item.input_audio_transcription.logprobs")]
    ItemInputAudioTranscriptionLogprobs,
}

impl Default for Include {
    fn default() -> Include {
        Self::ItemInputAudioTranscriptionLogprobs
    }
}

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