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    /// This is the provider-specific ID that will be used. Please note that ash, ballad, coral, sage, and verse may only be used with realtime models.
20    #[serde(rename = "voiceId")]
21    pub voice_id: VoiceId,
22    /// This is the speed multiplier that will be used.
23    #[serde(rename = "speed", skip_serializing_if = "Option::is_none")]
24    pub speed: Option<f64>,
25    /// This is the plan for chunking the model output before it is sent to the voice provider.
26    #[serde(rename = "chunkPlan", skip_serializing_if = "Option::is_none")]
27    pub chunk_plan: Option<Box<models::ChunkPlan>>,
28    /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
29    #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
30    pub fallback_plan: Option<Box<models::FallbackPlan>>,
31}
32
33impl OpenAiVoice {
34    pub fn new(provider: Provider, voice_id: VoiceId) -> OpenAiVoice {
35        OpenAiVoice {
36            provider,
37            voice_id,
38            speed: None,
39            chunk_plan: None,
40            fallback_plan: None,
41        }
42    }
43}
44/// This is the voice provider that will be used.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum Provider {
47    #[serde(rename = "openai")]
48    Openai,
49}
50
51impl Default for Provider {
52    fn default() -> Provider {
53        Self::Openai
54    }
55}
56/// This is the provider-specific ID that will be used. Please note that ash, ballad, coral, sage, and verse may only be used with realtime models.
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum VoiceId {
59    #[serde(rename = "alloy")]
60    Alloy,
61    #[serde(rename = "echo")]
62    Echo,
63    #[serde(rename = "fable")]
64    Fable,
65    #[serde(rename = "onyx")]
66    Onyx,
67    #[serde(rename = "nova")]
68    Nova,
69    #[serde(rename = "shimmer")]
70    Shimmer,
71    #[serde(rename = "ash")]
72    Ash,
73    #[serde(rename = "ballad")]
74    Ballad,
75    #[serde(rename = "coral")]
76    Coral,
77    #[serde(rename = "sage")]
78    Sage,
79    #[serde(rename = "verse")]
80    Verse,
81}
82
83impl Default for VoiceId {
84    fn default() -> VoiceId {
85        Self::Alloy
86    }
87}
88