vapi_client/models/format_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 FormatPlan {
17 /// This determines whether the chunk is formatted before being sent to the voice provider. This helps with enunciation. This includes phone numbers, emails and addresses. Default `true`. Usage: - To rely on the voice provider's formatting logic, set this to `false`. If `voice.chunkPlan.enabled` is `false`, this is automatically `false` since there's no chunk to format. @default true
18 #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
19 pub enabled: Option<bool>,
20 /// This is the cutoff after which a number is converted to individual digits instead of being spoken as words. Example: - If cutoff 2025, \"12345\" is converted to \"1 2 3 4 5\" while \"1200\" is converted to \"twelve hundred\". Usage: - If your use case doesn't involve IDs like zip codes, set this to a high value. - If your use case involves IDs that are shorter than 5 digits, set this to a lower value. @default 2025
21 #[serde(
22 rename = "numberToDigitsCutoff",
23 skip_serializing_if = "Option::is_none"
24 )]
25 pub number_to_digits_cutoff: Option<f64>,
26 /// These are the custom replacements you can make to the chunk before it is sent to the voice provider. Usage: - To replace a specific word or phrase with a different word or phrase, use the `ExactReplacement` type. Eg. `{ type: 'exact', key: 'hello', value: 'hi' }` - To replace a word or phrase that matches a pattern, use the `RegexReplacement` type. Eg. `{ type: 'regex', regex: '\\\\b[a-zA-Z]{5}\\\\b', value: 'hi' }` @default []
27 #[serde(rename = "replacements", skip_serializing_if = "Option::is_none")]
28 pub replacements: Option<Vec<models::FormatPlanReplacementsInner>>,
29 /// List of formatters to apply. If not provided, all default formatters will be applied. If provided, only the specified formatters will be applied. Note: Some essential formatters like angle bracket removal will always be applied. @default undefined
30 #[serde(rename = "formattersEnabled", skip_serializing_if = "Option::is_none")]
31 pub formatters_enabled: Option<Vec<FormattersEnabled>>,
32}
33
34impl FormatPlan {
35 pub fn new() -> FormatPlan {
36 FormatPlan {
37 enabled: None,
38 number_to_digits_cutoff: None,
39 replacements: None,
40 formatters_enabled: None,
41 }
42 }
43}
44/// List of formatters to apply. If not provided, all default formatters will be applied. If provided, only the specified formatters will be applied. Note: Some essential formatters like angle bracket removal will always be applied. @default undefined
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum FormattersEnabled {
47 #[serde(rename = "markdown")]
48 Markdown,
49 #[serde(rename = "asterisk")]
50 Asterisk,
51 #[serde(rename = "quote")]
52 Quote,
53 #[serde(rename = "dash")]
54 Dash,
55 #[serde(rename = "newline")]
56 Newline,
57 #[serde(rename = "colon")]
58 Colon,
59 #[serde(rename = "acronym")]
60 Acronym,
61 #[serde(rename = "dollarAmount")]
62 DollarAmount,
63 #[serde(rename = "email")]
64 Email,
65 #[serde(rename = "date")]
66 Date,
67 #[serde(rename = "time")]
68 Time,
69 #[serde(rename = "distance")]
70 Distance,
71 #[serde(rename = "unit")]
72 Unit,
73 #[serde(rename = "percentage")]
74 Percentage,
75 #[serde(rename = "phoneNumber")]
76 PhoneNumber,
77 #[serde(rename = "number")]
78 Number,
79}
80
81impl Default for FormattersEnabled {
82 fn default() -> FormattersEnabled {
83 Self::Markdown
84 }
85}