vapi_client/models/
assistant_overrides.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 AssistantOverrides {
16    #[serde(rename = "transcriber", skip_serializing_if = "Option::is_none")]
17    pub transcriber: Option<models::CreateAssistantDtoTranscriber>,
18    #[serde(rename = "model", skip_serializing_if = "Option::is_none")]
19    pub model: Option<models::CreateAssistantDtoModel>,
20    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
21    pub voice: Option<models::CreateAssistantDtoVoice>,
22    /// This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).  If unspecified, assistant will wait for user to speak and use the model to respond once they speak.
23    #[serde(rename = "firstMessage", skip_serializing_if = "Option::is_none")]
24    pub first_message: Option<String>,
25    #[serde(rename = "firstMessageInterruptionsEnabled", skip_serializing_if = "Option::is_none")]
26    pub first_message_interruptions_enabled: Option<bool>,
27    /// This is the mode for the first message. Default is 'assistant-speaks-first'.  Use: - 'assistant-speaks-first' to have the assistant speak first. - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).  @default 'assistant-speaks-first'
28    #[serde(rename = "firstMessageMode", skip_serializing_if = "Option::is_none")]
29    pub first_message_mode: Option<FirstMessageMode>,
30    #[serde(rename = "voicemailDetection", skip_serializing_if = "Option::is_none")]
31    pub voicemail_detection: Option<models::CreateAssistantDtoVoicemailDetection>,
32    /// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started. You can check the shape of the messages in ClientMessage schema.
33    #[serde(rename = "clientMessages", skip_serializing_if = "Option::is_none")]
34    pub client_messages: Option<Vec<ClientMessages>>,
35    /// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
36    #[serde(rename = "serverMessages", skip_serializing_if = "Option::is_none")]
37    pub server_messages: Option<Vec<ServerMessages>>,
38    /// How many seconds of silence to wait before ending the call. Defaults to 30.  @default 30
39    #[serde(rename = "silenceTimeoutSeconds", skip_serializing_if = "Option::is_none")]
40    pub silence_timeout_seconds: Option<f64>,
41    /// This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.  @default 600 (10 minutes)
42    #[serde(rename = "maxDurationSeconds", skip_serializing_if = "Option::is_none")]
43    pub max_duration_seconds: Option<f64>,
44    #[serde(rename = "backgroundSound", skip_serializing_if = "Option::is_none")]
45    pub background_sound: Option<models::CreateAssistantDtoBackgroundSound>,
46    /// This enables filtering of noise and background speech while the user is talking.  Default `false` while in beta.  @default false
47    #[serde(rename = "backgroundDenoisingEnabled", skip_serializing_if = "Option::is_none")]
48    pub background_denoising_enabled: Option<bool>,
49    /// This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.  Default `false` while in beta.  @default false
50    #[serde(rename = "modelOutputInMessagesEnabled", skip_serializing_if = "Option::is_none")]
51    pub model_output_in_messages_enabled: Option<bool>,
52    /// These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.
53    #[serde(rename = "transportConfigurations", skip_serializing_if = "Option::is_none")]
54    pub transport_configurations: Option<Vec<models::CreateAssistantDtoTransportConfigurationsInner>>,
55    /// This is the plan for observability configuration of assistant's calls. Currently supports Langfuse for tracing and monitoring.
56    #[serde(rename = "observabilityPlan", skip_serializing_if = "Option::is_none")]
57    pub observability_plan: Option<models::LangfuseObservabilityPlan>,
58    /// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials.
59    #[serde(rename = "credentials", skip_serializing_if = "Option::is_none")]
60    pub credentials: Option<Vec<models::CreateAssistantDtoCredentialsInner>>,
61    /// These are values that will be used to replace the template variables in the assistant messages and other text-based fields. This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html  So for example, `{{ name }}` will be replaced with the value of `name` in `variableValues`. `{{\"now\" | date: \"%b %d, %Y, %I:%M %p\", \"America/New_York\"}}` will be replaced with the current date and time in New York.  Some VAPI reserved defaults:  - *customer* - the customer object
62    #[serde(rename = "variableValues", skip_serializing_if = "Option::is_none")]
63    pub variable_values: Option<serde_json::Value>,
64    /// This is the name of the assistant.  This is required when you want to transfer between assistants in a call.
65    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
66    pub name: Option<String>,
67    /// This is the message that the assistant will say if the call is forwarded to voicemail.  If unspecified, it will hang up.
68    #[serde(rename = "voicemailMessage", skip_serializing_if = "Option::is_none")]
69    pub voicemail_message: Option<String>,
70    /// This is the message that the assistant will say if it ends the call.  If unspecified, it will hang up without saying anything.
71    #[serde(rename = "endCallMessage", skip_serializing_if = "Option::is_none")]
72    pub end_call_message: Option<String>,
73    /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
74    #[serde(rename = "endCallPhrases", skip_serializing_if = "Option::is_none")]
75    pub end_call_phrases: Option<Vec<String>>,
76    #[serde(rename = "compliancePlan", skip_serializing_if = "Option::is_none")]
77    pub compliance_plan: Option<models::CompliancePlan>,
78    /// This is for metadata you want to store on the assistant.
79    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
80    pub metadata: Option<serde_json::Value>,
81    /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
82    #[serde(rename = "analysisPlan", skip_serializing_if = "Option::is_none")]
83    pub analysis_plan: Option<models::AnalysisPlan>,
84    /// This is the plan for artifacts generated during assistant's calls. Stored in `call.artifact`.  Note: `recordingEnabled` is currently at the root level. It will be moved to `artifactPlan` in the future, but will remain backwards compatible.
85    #[serde(rename = "artifactPlan", skip_serializing_if = "Option::is_none")]
86    pub artifact_plan: Option<models::ArtifactPlan>,
87    /// This is the plan for static predefined messages that can be spoken by the assistant during the call, like `idleMessages`.  Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.
88    #[serde(rename = "messagePlan", skip_serializing_if = "Option::is_none")]
89    pub message_plan: Option<models::MessagePlan>,
90    /// This is the plan for when the assistant should start talking.  You should configure this if you're running into these issues: - The assistant is too slow to start talking after the customer is done speaking. - The assistant is too fast to start talking after the customer is done speaking. - The assistant is so fast that it's actually interrupting the customer.
91    #[serde(rename = "startSpeakingPlan", skip_serializing_if = "Option::is_none")]
92    pub start_speaking_plan: Option<models::StartSpeakingPlan>,
93    /// This is the plan for when assistant should stop talking on customer interruption.  You should configure this if you're running into these issues: - The assistant is too slow to recognize customer's interruption. - The assistant is too fast to recognize customer's interruption. - The assistant is getting interrupted by phrases that are just acknowledgments. - The assistant is getting interrupted by background noises. - The assistant is not properly stopping -- it starts talking right after getting interrupted.
94    #[serde(rename = "stopSpeakingPlan", skip_serializing_if = "Option::is_none")]
95    pub stop_speaking_plan: Option<models::StopSpeakingPlan>,
96    /// This is the plan for real-time monitoring of the assistant's calls.  Usage: - To enable live listening of the assistant's calls, set `monitorPlan.listenEnabled` to `true`. - To enable live control of the assistant's calls, set `monitorPlan.controlEnabled` to `true`.  Note, `serverMessages`, `clientMessages`, `serverUrl` and `serverUrlSecret` are currently at the root level but will be moved to `monitorPlan` in the future. Will remain backwards compatible
97    #[serde(rename = "monitorPlan", skip_serializing_if = "Option::is_none")]
98    pub monitor_plan: Option<models::MonitorPlan>,
99    /// These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.
100    #[serde(rename = "credentialIds", skip_serializing_if = "Option::is_none")]
101    pub credential_ids: Option<Vec<String>>,
102    /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.  The order of precedence is:  1. assistant.server.url 2. phoneNumber.serverUrl 3. org.serverUrl
103    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
104    pub server: Option<models::Server>,
105    /// This is a set of actions that will be performed on certain events.
106    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
107    pub hooks: Option<Vec<models::AssistantHooks>>,
108    #[serde(rename = "keypadInputPlan", skip_serializing_if = "Option::is_none")]
109    pub keypad_input_plan: Option<models::KeypadInputPlan>,
110}
111
112impl AssistantOverrides {
113    pub fn new() -> AssistantOverrides {
114        AssistantOverrides {
115            transcriber: None,
116            model: None,
117            voice: None,
118            first_message: None,
119            first_message_interruptions_enabled: None,
120            first_message_mode: None,
121            voicemail_detection: None,
122            client_messages: None,
123            server_messages: None,
124            silence_timeout_seconds: None,
125            max_duration_seconds: None,
126            background_sound: None,
127            background_denoising_enabled: None,
128            model_output_in_messages_enabled: None,
129            transport_configurations: None,
130            observability_plan: None,
131            credentials: None,
132            variable_values: None,
133            name: None,
134            voicemail_message: None,
135            end_call_message: None,
136            end_call_phrases: None,
137            compliance_plan: None,
138            metadata: None,
139            analysis_plan: None,
140            artifact_plan: None,
141            message_plan: None,
142            start_speaking_plan: None,
143            stop_speaking_plan: None,
144            monitor_plan: None,
145            credential_ids: None,
146            server: None,
147            hooks: None,
148            keypad_input_plan: None,
149        }
150    }
151}
152/// This is the mode for the first message. Default is 'assistant-speaks-first'.  Use: - 'assistant-speaks-first' to have the assistant speak first. - 'assistant-waits-for-user' to have the assistant wait for the user to speak first. - 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (`assistant.model.messages` at call start, `call.messages` at squad transfer points).  @default 'assistant-speaks-first'
153#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
154pub enum FirstMessageMode {
155    #[serde(rename = "assistant-speaks-first")]
156    AssistantSpeaksFirst,
157    #[serde(rename = "assistant-speaks-first-with-model-generated-message")]
158    AssistantSpeaksFirstWithModelGeneratedMessage,
159    #[serde(rename = "assistant-waits-for-user")]
160    AssistantWaitsForUser,
161}
162
163impl Default for FirstMessageMode {
164    fn default() -> FirstMessageMode {
165        Self::AssistantSpeaksFirst
166    }
167}
168/// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started. You can check the shape of the messages in ClientMessage schema.
169#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
170pub enum ClientMessages {
171    #[serde(rename = "conversation-update")]
172    ConversationUpdate,
173    #[serde(rename = "function-call")]
174    FunctionCall,
175    #[serde(rename = "function-call-result")]
176    FunctionCallResult,
177    #[serde(rename = "hang")]
178    Hang,
179    #[serde(rename = "language-changed")]
180    LanguageChanged,
181    #[serde(rename = "metadata")]
182    Metadata,
183    #[serde(rename = "model-output")]
184    ModelOutput,
185    #[serde(rename = "speech-update")]
186    SpeechUpdate,
187    #[serde(rename = "status-update")]
188    StatusUpdate,
189    #[serde(rename = "transcript")]
190    Transcript,
191    #[serde(rename = "tool-calls")]
192    ToolCalls,
193    #[serde(rename = "tool-calls-result")]
194    ToolCallsResult,
195    #[serde(rename = "transfer-update")]
196    TransferUpdate,
197    #[serde(rename = "user-interrupted")]
198    UserInterrupted,
199    #[serde(rename = "voice-input")]
200    VoiceInput,
201    #[serde(rename = "workflow.node.started")]
202    WorkflowPeriodNodePeriodStarted,
203}
204
205impl Default for ClientMessages {
206    fn default() -> ClientMessages {
207        Self::ConversationUpdate
208    }
209}
210/// These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.
211#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
212pub enum ServerMessages {
213    #[serde(rename = "conversation-update")]
214    ConversationUpdate,
215    #[serde(rename = "end-of-call-report")]
216    EndOfCallReport,
217    #[serde(rename = "function-call")]
218    FunctionCall,
219    #[serde(rename = "hang")]
220    Hang,
221    #[serde(rename = "language-changed")]
222    LanguageChanged,
223    #[serde(rename = "language-change-detected")]
224    LanguageChangeDetected,
225    #[serde(rename = "model-output")]
226    ModelOutput,
227    #[serde(rename = "phone-call-control")]
228    PhoneCallControl,
229    #[serde(rename = "speech-update")]
230    SpeechUpdate,
231    #[serde(rename = "status-update")]
232    StatusUpdate,
233    #[serde(rename = "transcript")]
234    Transcript,
235    #[serde(rename = "transcript[transcriptType=\"final\"]")]
236    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
237    #[serde(rename = "tool-calls")]
238    ToolCalls,
239    #[serde(rename = "transfer-destination-request")]
240    TransferDestinationRequest,
241    #[serde(rename = "transfer-update")]
242    TransferUpdate,
243    #[serde(rename = "user-interrupted")]
244    UserInterrupted,
245    #[serde(rename = "voice-input")]
246    VoiceInput,
247}
248
249impl Default for ServerMessages {
250    fn default() -> ServerMessages {
251        Self::ConversationUpdate
252    }
253}
254