vapi_client/models/
chunk_plan.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 ChunkPlan {
17    /// This determines whether the model output is chunked before being sent to the voice provider. Default `true`.  
18    /// Usage:
19    /// - To rely on the voice provider's audio generation logic, set this to `false`.
20    /// - If seeing issues with quality, set this to `true`.  
21    /// If disabled, Vapi-provided audio control tokens like <flush /> will not work.  
22    /// @default true
23    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
24    pub enabled: Option<bool>,
25
26    /// This is the minimum number of characters in a chunk.  
27    /// Usage:
28    /// - To increase quality, set this to a higher value.
29    /// - To decrease latency, set this to a lower value.  
30    /// @default 30
31    #[serde(rename = "minCharacters", skip_serializing_if = "Option::is_none")]
32    pub min_characters: Option<f64>,
33
34    /// These are the punctuations that are considered valid boundaries for a chunk to be created.  
35    /// Usage:
36    /// - To increase quality, constrain to fewer boundaries.
37    /// - To decrease latency, enable all.  
38    /// Default is automatically set to balance the trade-off between quality and latency based on the provider.
39    #[serde(
40        rename = "punctuationBoundaries",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub punctuation_boundaries: Option<Vec<PunctuationBoundaries>>,
44
45    /// This is the plan for formatting the chunk before it is sent to the voice provider.
46    #[serde(rename = "formatPlan", skip_serializing_if = "Option::is_none")]
47    pub format_plan: Option<models::FormatPlan>,
48}
49
50impl ChunkPlan {
51    pub fn new() -> ChunkPlan {
52        ChunkPlan {
53            enabled: None,
54            min_characters: None,
55            punctuation_boundaries: None,
56            format_plan: None,
57        }
58    }
59}
60
61/// These are the punctuations that are considered valid boundaries for a chunk to be created.  
62/// Usage:
63/// - To increase quality, constrain to fewer boundaries.
64/// - To decrease latency, enable all.  
65/// Default is automatically set to balance the trade-off between quality and latency based on the provider.
66#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
67pub enum PunctuationBoundaries {
68    #[serde(rename = "。")]
69    IdeographicFullStop,
70
71    #[serde(rename = ",")]
72    IdeographicComma,
73
74    #[serde(rename = ".")]
75    Period,
76
77    #[serde(rename = "!")]
78    Exclamation,
79
80    #[serde(rename = "?")]
81    QuestionMark,
82
83    #[serde(rename = ";")]
84    Semicolon,
85
86    #[serde(rename = ")")]
87    RightParenthesis,
88
89    #[serde(rename = "،")]
90    ArabicComma,
91
92    #[serde(rename = "۔")]
93    ArabicFullStop,
94
95    #[serde(rename = "।")]
96    DevanagariDanda,
97
98    #[serde(rename = "॥")]
99    DevanagariDoubleDanda,
100
101    #[serde(rename = "|")]
102    SinglePipe,
103
104    #[serde(rename = "||")]
105    DoublePipe,
106
107    #[serde(rename = ",")]
108    Comma,
109
110    #[serde(rename = ":")]
111    Colon,
112}
113
114impl Default for PunctuationBoundaries {
115    fn default() -> Self {
116        // Choose whichever you want as the default.
117        // You could also remove this impl if you don't need a default variant.
118        PunctuationBoundaries::Period
119    }
120}