vapi_client/models/
custom_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 CustomVoice {
19    /// This is the voice provider that will be used. Use `custom-voice` for providers that are not natively supported.
20    #[serde(rename = "provider")]
21    pub provider: Provider,
22    /// This is the plan for chunking the model output before it is sent to the voice provider.
23    #[serde(rename = "chunkPlan", skip_serializing_if = "Option::is_none")]
24    pub chunk_plan: Option<models::ChunkPlan>,
25    /// This is where the voice request will be sent.  Request Example:  POST https://{server.url} Content-Type: application/json  {   \"message\": {     \"type\": \"voice-request\",     \"text\": \"Hello, world!\",     \"sampleRate\": 24000,     ...other metadata about the call...   } }  Response Expected: 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport: ``` response.on('data', (chunk: Buffer) => {   outputStream.write(chunk); }); ```
26    #[serde(rename = "server")]
27    pub server: models::Server,
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<models::FallbackPlan>,
31}
32
33impl CustomVoice {
34    pub fn new(provider: Provider, server: models::Server) -> CustomVoice {
35        CustomVoice {
36            provider,
37            chunk_plan: None,
38            server,
39            fallback_plan: None,
40        }
41    }
42}
43/// This is the voice provider that will be used. Use `custom-voice` for providers that are not natively supported.
44#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
45pub enum Provider {
46    #[serde(rename = "custom-voice")]
47    CustomVoice,
48}
49
50impl Default for Provider {
51    fn default() -> Provider {
52        Self::CustomVoice
53    }
54}