vapi_client/models/
assistant_custom_endpointing_rule.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 AssistantCustomEndpointingRule {
16    /// 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.
17    #[serde(rename = "type")]
18    pub r#type: TypeTrue,
19    /// 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$\".
20    #[serde(rename = "regex")]
21    pub regex: String,
22    /// These are the options for the regex match. Defaults to all disabled.  @default []
23    #[serde(rename = "regexOptions", skip_serializing_if = "Option::is_none")]
24    pub regex_options: Option<Vec<models::RegexOption>>,
25    /// This is the endpointing timeout in seconds, if the rule is matched.
26    #[serde(rename = "timeoutSeconds")]
27    pub timeout_seconds: f64,
28}
29
30impl AssistantCustomEndpointingRule {
31    pub fn new(
32        r#type: TypeTrue,
33        regex: String,
34        timeout_seconds: f64,
35    ) -> AssistantCustomEndpointingRule {
36        AssistantCustomEndpointingRule {
37            r#type,
38            regex,
39            regex_options: None,
40            timeout_seconds,
41        }
42    }
43}
44/// 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.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum TypeTrue {
47    #[serde(rename = "assistant")]
48    Assistant,
49}
50
51impl Default for TypeTrue {
52    fn default() -> TypeTrue {
53        Self::Assistant
54    }
55}