vapi_client/models/custom_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 CustomVoice {
16 /// This is the voice provider that will be used. Use `custom-voice` for providers that are not natively supported.
17 #[serde(rename = "provider")]
18 pub provider: Provider,
19 /// This is the plan for chunking the model output before it is sent to the voice provider.
20 #[serde(rename = "chunkPlan", skip_serializing_if = "Option::is_none")]
21 pub chunk_plan: Option<Box<models::ChunkPlan>>,
22 /// 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); }); ```
23 #[serde(rename = "server")]
24 pub server: Box<models::Server>,
25 /// This is the plan for voice provider fallbacks in the event that the primary voice provider fails.
26 #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
27 pub fallback_plan: Option<Box<models::FallbackPlan>>,
28}
29
30impl CustomVoice {
31 pub fn new(provider: Provider, server: models::Server) -> CustomVoice {
32 CustomVoice {
33 provider,
34 chunk_plan: None,
35 server: Box::new(server),
36 fallback_plan: None,
37 }
38 }
39}
40/// This is the voice provider that will be used. Use `custom-voice` for providers that are not natively supported.
41#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
42pub enum Provider {
43 #[serde(rename = "custom-voice")]
44 CustomVoice,
45}
46
47impl Default for Provider {
48 fn default() -> Provider {
49 Self::CustomVoice
50 }
51}
52