vapi_client/models/
chunk_plan.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 ChunkPlan {
16    /// 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
17    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
18    pub enabled: Option<bool>,
19    /// 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
20    #[serde(rename = "minCharacters", skip_serializing_if = "Option::is_none")]
21    pub min_characters: Option<f64>,
22    /// 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.
23    #[serde(
24        rename = "punctuationBoundaries",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub punctuation_boundaries: Option<Vec<PunctuationBoundary>>,
28    /// This is the plan for formatting the chunk before it is sent to the voice provider.
29    #[serde(rename = "formatPlan", skip_serializing_if = "Option::is_none")]
30    pub format_plan: Option<models::FormatPlan>,
31}
32
33impl ChunkPlan {
34    pub fn new() -> ChunkPlan {
35        ChunkPlan {
36            enabled: None,
37            min_characters: None,
38            punctuation_boundaries: None,
39            format_plan: None,
40        }
41    }
42}
43
44/// Punctuation boundaries that are considered valid for chunk creation
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum PunctuationBoundary {
47    #[serde(rename = "。")]
48    ChinesePeriod,
49    #[serde(rename = ",")]
50    ChineseComma,
51    #[serde(rename = ".")]
52    Period,
53    #[serde(rename = "!")]
54    Exclamation,
55    #[serde(rename = "?")]
56    QuestionMark,
57    #[serde(rename = ";")]
58    Semicolon,
59    #[serde(rename = ")")]
60    RightParenthesis,
61    #[serde(rename = "،")]
62    ArabicComma,
63    #[serde(rename = "۔")]
64    UrduPeriod,
65    #[serde(rename = "।")]
66    DevanagariDanda,
67    #[serde(rename = "॥")]
68    DevanagariDoubleDanda,
69    #[serde(rename = "|")]
70    Pipe,
71    #[serde(rename = "||")]
72    DoublePipe,
73    #[serde(rename = ",")]
74    Comma,
75    #[serde(rename = ":")]
76    Colon,
77}
78
79impl Default for PunctuationBoundary {
80    fn default() -> PunctuationBoundary {
81        Self::Period
82    }
83}