vapi_client/models/
open_ai_voice.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct OpenAiVoice {
19    /// This is the voice provider that will be used.
20    #[serde(rename = "provider")]
21    pub provider: Provider,
22    /// 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.
23    #[serde(rename = "voiceId")]
24    pub voice_id: VoiceId,
25    /// This is the speed multiplier that will be used.
26    #[serde(rename = "speed", skip_serializing_if = "Option::is_none")]
27    pub speed: Option<f64>,
28    /// This is the plan for chunking the model output before it is sent to the voice provider.
29    #[serde(rename = "chunkPlan", skip_serializing_if = "Option::is_none")]
30    pub chunk_plan: Option<models::ChunkPlan>,
31    /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
32    #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
33    pub fallback_plan: Option<models::FallbackPlan>,
34}
35
36impl OpenAiVoice {
37    pub fn new(provider: Provider, voice_id: VoiceId) -> OpenAiVoice {
38        OpenAiVoice {
39            provider,
40            voice_id,
41            speed: None,
42            chunk_plan: None,
43            fallback_plan: None,
44        }
45    }
46}
47/// This is the voice provider that will be used.
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
49pub enum Provider {
50    #[serde(rename = "openai")]
51    Openai,
52}
53
54impl Default for Provider {
55    fn default() -> Provider {
56        Self::Openai
57    }
58}
59/// 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.
60#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
61pub enum VoiceId {
62    #[serde(rename = "alloy")]
63    Alloy,
64    #[serde(rename = "echo")]
65    Echo,
66    #[serde(rename = "fable")]
67    Fable,
68    #[serde(rename = "onyx")]
69    Onyx,
70    #[serde(rename = "nova")]
71    Nova,
72    #[serde(rename = "shimmer")]
73    Shimmer,
74    #[serde(rename = "ash")]
75    Ash,
76    #[serde(rename = "ballad")]
77    Ballad,
78    #[serde(rename = "coral")]
79    Coral,
80    #[serde(rename = "sage")]
81    Sage,
82    #[serde(rename = "verse")]
83    Verse,
84}
85
86impl Default for VoiceId {
87    fn default() -> VoiceId {
88        Self::Alloy
89    }
90}