vapi_client/models/
both_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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct BothCustomEndpointingRule {
19    /// This endpointing rule is based on both the last assistant message and the current customer message as they are speaking.  Flow: - Assistant speaks - Customer starts speaking - Customer transcription comes in - This rule is evaluated on the last assistant message and the current customer transcription - If assistant message matches `assistantRegex` AND customer message matches `customerRegex`, the endpointing timeout is set to `timeoutSeconds`  Usage: - If you want to wait longer while customer is speaking numbers, you can set a longer timeout.
20    #[serde(rename = "type")]
21    pub r#type: Type,
22    /// This is the regex pattern to match the assistant's message.  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$\".
23    #[serde(rename = "assistantRegex")]
24    pub assistant_regex: String,
25    /// These are the options for the assistant's message regex match. Defaults to all disabled.  @default []
26    #[serde(
27        rename = "assistantRegexOptions",
28        skip_serializing_if = "Option::is_none"
29    )]
30    pub assistant_regex_options: Option<Vec<models::RegexOption>>,
31    #[serde(rename = "customerRegex")]
32    pub customer_regex: String,
33    /// These are the options for the customer's message regex match. Defaults to all disabled.  @default []
34    #[serde(
35        rename = "customerRegexOptions",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub customer_regex_options: Option<Vec<models::RegexOption>>,
39    /// This is the endpointing timeout in seconds, if the rule is matched.
40    #[serde(rename = "timeoutSeconds")]
41    pub timeout_seconds: f64,
42}
43
44impl BothCustomEndpointingRule {
45    pub fn new(
46        r#type: Type,
47        assistant_regex: String,
48        customer_regex: String,
49        timeout_seconds: f64,
50    ) -> BothCustomEndpointingRule {
51        BothCustomEndpointingRule {
52            r#type,
53            assistant_regex,
54            assistant_regex_options: None,
55            customer_regex,
56            customer_regex_options: None,
57            timeout_seconds,
58        }
59    }
60}
61/// This endpointing rule is based on both the last assistant message and the current customer message as they are speaking.  Flow: - Assistant speaks - Customer starts speaking - Customer transcription comes in - This rule is evaluated on the last assistant message and the current customer transcription - If assistant message matches `assistantRegex` AND customer message matches `customerRegex`, the endpointing timeout is set to `timeoutSeconds`  Usage: - If you want to wait longer while customer is speaking numbers, you can set a longer timeout.
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
63pub enum Type {
64    #[serde(rename = "both")]
65    Both,
66}
67
68impl Default for Type {
69    fn default() -> Type {
70        Self::Both
71    }
72}