1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* Vapi API
*
* Voice AI for developers.
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChunkPlan {
/// This determines whether the model output is chunked before being sent to the voice provider. Default `true`. Usage: - To rely on the voice provider's audio generation logic, set this to `false`. - If seeing issues with quality, set this to `true`. If disabled, Vapi-provided audio control tokens like <flush /> will not work. @default true
#[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// This is the minimum number of characters in a chunk. Usage: - To increase quality, set this to a higher value. - To decrease latency, set this to a lower value. @default 30
#[serde(rename = "minCharacters", skip_serializing_if = "Option::is_none")]
pub min_characters: Option<f64>,
/// These are the punctuations that are considered valid boundaries for a chunk to be created. Usage: - To increase quality, constrain to fewer boundaries. - To decrease latency, enable all. Default is automatically set to balance the trade-off between quality and latency based on the provider.
#[serde(
rename = "punctuationBoundaries",
skip_serializing_if = "Option::is_none"
)]
pub punctuation_boundaries: Option<Vec<PunctuationBoundary>>,
/// This is the plan for formatting the chunk before it is sent to the voice provider.
#[serde(rename = "formatPlan", skip_serializing_if = "Option::is_none")]
pub format_plan: Option<models::FormatPlan>,
}
impl ChunkPlan {
pub fn new() -> ChunkPlan {
ChunkPlan {
enabled: None,
min_characters: None,
punctuation_boundaries: None,
format_plan: None,
}
}
}
/// Punctuation boundaries that are considered valid for chunk creation
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PunctuationBoundary {
#[serde(rename = "。")]
ChinesePeriod,
#[serde(rename = ",")]
ChineseComma,
#[serde(rename = ".")]
Period,
#[serde(rename = "!")]
Exclamation,
#[serde(rename = "?")]
QuestionMark,
#[serde(rename = ";")]
Semicolon,
#[serde(rename = ")")]
RightParenthesis,
#[serde(rename = "،")]
ArabicComma,
#[serde(rename = "۔")]
UrduPeriod,
#[serde(rename = "।")]
DevanagariDanda,
#[serde(rename = "॥")]
DevanagariDoubleDanda,
#[serde(rename = "|")]
Pipe,
#[serde(rename = "||")]
DoublePipe,
#[serde(rename = ",")]
Comma,
#[serde(rename = ":")]
Colon,
}
impl Default for PunctuationBoundary {
fn default() -> PunctuationBoundary {
Self::Period
}
}