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