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