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