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