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