vapi_client/models/
open_ai_voice.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OpenAiVoice {
16    /// This is the voice provider that will be used.
17    #[serde(rename = "provider")]
18    pub provider: Provider,
19    #[serde(rename = "voiceId")]
20    pub voice_id: models::OpenAiVoiceVoiceId,
21    /// This is the model that will be used for text-to-speech.
22    #[serde(rename = "model", skip_serializing_if = "Option::is_none")]
23    pub model: Option<Model>,
24    /// This is a prompt that allows you to control the voice of your generated audio. Does not work with 'tts-1' or 'tts-1-hd' models.
25    #[serde(rename = "instructions", skip_serializing_if = "Option::is_none")]
26    pub instructions: Option<String>,
27    /// This is the speed multiplier that will be used.
28    #[serde(rename = "speed", skip_serializing_if = "Option::is_none")]
29    pub speed: Option<f64>,
30    /// This is the plan for chunking the model output before it is sent to the voice provider.
31    #[serde(rename = "chunkPlan", skip_serializing_if = "Option::is_none")]
32    pub chunk_plan: Option<models::ChunkPlan>,
33    /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
34    #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
35    pub fallback_plan: Option<models::FallbackPlan>,
36}
37
38impl OpenAiVoice {
39    pub fn new(provider: Provider, voice_id: models::OpenAiVoiceVoiceId) -> OpenAiVoice {
40        OpenAiVoice {
41            provider,
42            voice_id,
43            model: None,
44            instructions: None,
45            speed: None,
46            chunk_plan: None,
47            fallback_plan: None,
48        }
49    }
50}
51/// This is the voice provider that will be used.
52#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
53pub enum Provider {
54    #[serde(rename = "openai")]
55    Openai,
56}
57
58impl Default for Provider {
59    fn default() -> Provider {
60        Self::Openai
61    }
62}
63/// This is the model that will be used for text-to-speech.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum Model {
66    #[serde(rename = "tts-1")]
67    Tts1,
68    #[serde(rename = "tts-1-hd")]
69    Tts1Hd,
70    #[serde(rename = "gpt-4o-mini-tts")]
71    Gpt4oMiniTts,
72}
73
74impl Default for Model {
75    fn default() -> Model {
76        Self::Tts1
77    }
78}
79