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 flag to toggle voice caching for the assistant.
17 #[serde(rename = "cachingEnabled", skip_serializing_if = "Option::is_none")]
18 pub caching_enabled: Option<bool>,
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: ProviderTrue,
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: ProviderTrue, server: models::Server) -> CustomVoice {
35 CustomVoice {
36 caching_enabled: None,
37 provider,
38 chunk_plan: None,
39 server,
40 fallback_plan: None,
41 }
42 }
43}
44/// This is the voice provider that will be used. Use `custom-voice` for providers that are not natively supported.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum ProviderTrue {
47 #[serde(rename = "custom-voice")]
48 CustomVoice,
49}
50
51impl Default for ProviderTrue {
52 fn default() -> ProviderTrue {
53 Self::CustomVoice
54 }
55}