vapi_client/models/
assistant_custom_endpointing_rule.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 AssistantCustomEndpointingRule {
17    /// This endpointing rule is based on the last assistant message before customer started speaking.  Flow: - Assistant speaks - Customer starts speaking - Customer transcription comes in - This rule is evaluated on the last assistant message - If a match is found based on `regex`, the endpointing timeout is set to `timeoutSeconds`  Usage: - If you have yes/no questions in your use case like \"are you interested in a loan?\", you can set a shorter timeout. - If you have questions where the customer may pause to look up information like \"what's my account number?\", you can set a longer timeout.
18    #[serde(rename = "type")]
19    pub r#type: Type,
20    /// This is the regex pattern to match.  Note: - This works by using the `RegExp.test` method in Node.JS. Eg. `/hello/.test(\"hello there\")` will return `true`.  Hot tip: - In JavaScript, escape `\\` when sending the regex pattern. Eg. `\"hello\\sthere\"` will be sent over the wire as `\"hellosthere\"`. Send `\"hello\\\\sthere\"` instead. - `RegExp.test` does substring matching, so `/cat/.test(\"I love cats\")` will return `true`. To do full string matching, send \"^cat$\".
21    #[serde(rename = "regex")]
22    pub regex: String,
23    /// These are the options for the regex match. Defaults to all disabled.  @default []
24    #[serde(rename = "regexOptions", skip_serializing_if = "Option::is_none")]
25    pub regex_options: Option<Vec<models::RegexOption>>,
26    /// This is the endpointing timeout in seconds, if the rule is matched.
27    #[serde(rename = "timeoutSeconds")]
28    pub timeout_seconds: f64,
29}
30
31impl AssistantCustomEndpointingRule {
32    pub fn new(
33        r#type: Type,
34        regex: String,
35        timeout_seconds: f64,
36    ) -> AssistantCustomEndpointingRule {
37        AssistantCustomEndpointingRule {
38            r#type,
39            regex,
40            regex_options: None,
41            timeout_seconds,
42        }
43    }
44}
45/// This endpointing rule is based on the last assistant message before customer started speaking.  Flow: - Assistant speaks - Customer starts speaking - Customer transcription comes in - This rule is evaluated on the last assistant message - If a match is found based on `regex`, the endpointing timeout is set to `timeoutSeconds`  Usage: - If you have yes/no questions in your use case like \"are you interested in a loan?\", you can set a shorter timeout. - If you have questions where the customer may pause to look up information like \"what's my account number?\", you can set a longer timeout.
46#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
47pub enum Type {
48    #[serde(rename = "assistant")]
49    Assistant,
50}
51
52impl Default for Type {
53    fn default() -> Type {
54        Self::Assistant
55    }
56}