vapi_client/models/
update_assistant_dto.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 UpdateAssistantDto {
19    #[serde(rename = "transcriber", skip_serializing_if = "Option::is_none")]
20    pub transcriber: Option<models::CreateAssistantDtoTranscriber>,
21    #[serde(rename = "model", skip_serializing_if = "Option::is_none")]
22    pub model: Option<models::CreateAssistantDtoModel>,
23    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
24    pub voice: Option<models::CreateAssistantDtoVoice>,
25    /// 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.
26    #[serde(rename = "firstMessage", skip_serializing_if = "Option::is_none")]
27    pub first_message: Option<String>,
28    /// 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'
29    #[serde(rename = "firstMessageMode", skip_serializing_if = "Option::is_none")]
30    pub first_message_mode: Option<FirstMessageMode>,
31    /// These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
32    #[serde(rename = "voicemailDetection", skip_serializing_if = "Option::is_none")]
33    pub voicemail_detection: Option<serde_json::Value>,
34    /// 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. You can check the shape of the messages in ClientMessage schema.
35    #[serde(rename = "clientMessages", skip_serializing_if = "Option::is_none")]
36    pub client_messages: Option<Vec<ClientMessages>>,
37    /// 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.
38    #[serde(rename = "serverMessages", skip_serializing_if = "Option::is_none")]
39    pub server_messages: Option<Vec<ServerMessages>>,
40    /// How many seconds of silence to wait before ending the call. Defaults to 30.  @default 30
41    #[serde(
42        rename = "silenceTimeoutSeconds",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub silence_timeout_seconds: Option<f64>,
46    /// 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)
47    #[serde(rename = "maxDurationSeconds", skip_serializing_if = "Option::is_none")]
48    pub max_duration_seconds: Option<f64>,
49    /// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
50    #[serde(rename = "backgroundSound", skip_serializing_if = "Option::is_none")]
51    pub background_sound: Option<BackgroundSound>,
52    /// This enables filtering of noise and background speech while the user is talking.  Default `false` while in beta.  @default false
53    #[serde(
54        rename = "backgroundDenoisingEnabled",
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub background_denoising_enabled: Option<bool>,
58    /// 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
59    #[serde(
60        rename = "modelOutputInMessagesEnabled",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub model_output_in_messages_enabled: Option<bool>,
64    /// 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.
65    #[serde(
66        rename = "transportConfigurations",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub transport_configurations:
70        Option<Vec<models::CreateAssistantDtoTransportConfigurationsInner>>,
71    /// 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.
72    #[serde(rename = "credentials", skip_serializing_if = "Option::is_none")]
73    pub credentials: Option<Vec<models::CreateAssistantDtoCredentialsInner>>,
74    /// This is the name of the assistant.  This is required when you want to transfer between assistants in a call.
75    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
76    pub name: Option<String>,
77    /// This is the message that the assistant will say if the call is forwarded to voicemail.  If unspecified, it will hang up.
78    #[serde(rename = "voicemailMessage", skip_serializing_if = "Option::is_none")]
79    pub voicemail_message: Option<String>,
80    /// This is the message that the assistant will say if it ends the call.  If unspecified, it will hang up without saying anything.
81    #[serde(rename = "endCallMessage", skip_serializing_if = "Option::is_none")]
82    pub end_call_message: Option<String>,
83    /// This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
84    #[serde(rename = "endCallPhrases", skip_serializing_if = "Option::is_none")]
85    pub end_call_phrases: Option<Vec<String>>,
86    #[serde(rename = "compliancePlan", skip_serializing_if = "Option::is_none")]
87    pub compliance_plan: Option<models::CompliancePlan>,
88    /// This is for metadata you want to store on the assistant.
89    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
90    pub metadata: Option<serde_json::Value>,
91    /// This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
92    #[serde(rename = "analysisPlan", skip_serializing_if = "Option::is_none")]
93    pub analysis_plan: Option<models::AnalysisPlan>,
94    /// 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.
95    #[serde(rename = "artifactPlan", skip_serializing_if = "Option::is_none")]
96    pub artifact_plan: Option<models::ArtifactPlan>,
97    /// 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.
98    #[serde(rename = "messagePlan", skip_serializing_if = "Option::is_none")]
99    pub message_plan: Option<models::MessagePlan>,
100    /// 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.
101    #[serde(rename = "startSpeakingPlan", skip_serializing_if = "Option::is_none")]
102    pub start_speaking_plan: Option<models::StartSpeakingPlan>,
103    /// 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.
104    #[serde(rename = "stopSpeakingPlan", skip_serializing_if = "Option::is_none")]
105    pub stop_speaking_plan: Option<models::StopSpeakingPlan>,
106    /// 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
107    #[serde(rename = "monitorPlan", skip_serializing_if = "Option::is_none")]
108    pub monitor_plan: Option<models::MonitorPlan>,
109    /// 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.
110    #[serde(rename = "credentialIds", skip_serializing_if = "Option::is_none")]
111    pub credential_ids: Option<Vec<String>>,
112    /// 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
113    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
114    pub server: Option<models::Server>,
115    /// This is a set of actions that will be performed on certain events.
116    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
117    pub hooks: Option<Vec<models::AssistantHooks>>,
118    #[serde(rename = "keypadInputPlan", skip_serializing_if = "Option::is_none")]
119    pub keypad_input_plan: Option<models::KeypadInputPlan>,
120}
121
122impl UpdateAssistantDto {
123    pub fn new() -> UpdateAssistantDto {
124        UpdateAssistantDto {
125            transcriber: None,
126            model: None,
127            voice: None,
128            first_message: None,
129            first_message_mode: None,
130            voicemail_detection: None,
131            client_messages: None,
132            server_messages: None,
133            silence_timeout_seconds: None,
134            max_duration_seconds: None,
135            background_sound: None,
136            background_denoising_enabled: None,
137            model_output_in_messages_enabled: None,
138            transport_configurations: None,
139            credentials: None,
140            name: None,
141            voicemail_message: None,
142            end_call_message: None,
143            end_call_phrases: None,
144            compliance_plan: None,
145            metadata: None,
146            analysis_plan: None,
147            artifact_plan: None,
148            message_plan: None,
149            start_speaking_plan: None,
150            stop_speaking_plan: None,
151            monitor_plan: None,
152            credential_ids: None,
153            server: None,
154            hooks: None,
155            keypad_input_plan: None,
156        }
157    }
158}
159/// 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'
160#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
161pub enum FirstMessageMode {
162    #[serde(rename = "assistant-speaks-first")]
163    AssistantSpeaksFirst,
164    #[serde(rename = "assistant-speaks-first-with-model-generated-message")]
165    AssistantSpeaksFirstWithModelGeneratedMessage,
166    #[serde(rename = "assistant-waits-for-user")]
167    AssistantWaitsForUser,
168}
169
170impl Default for FirstMessageMode {
171    fn default() -> FirstMessageMode {
172        Self::AssistantSpeaksFirst
173    }
174}
175/// 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. You can check the shape of the messages in ClientMessage schema.
176#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
177pub enum ClientMessages {
178    #[serde(rename = "conversation-update")]
179    ConversationUpdate,
180    #[serde(rename = "function-call")]
181    FunctionCall,
182    #[serde(rename = "function-call-result")]
183    FunctionCallResult,
184    #[serde(rename = "hang")]
185    Hang,
186    #[serde(rename = "language-changed")]
187    LanguageChanged,
188    #[serde(rename = "metadata")]
189    Metadata,
190    #[serde(rename = "model-output")]
191    ModelOutput,
192    #[serde(rename = "speech-update")]
193    SpeechUpdate,
194    #[serde(rename = "status-update")]
195    StatusUpdate,
196    #[serde(rename = "transcript")]
197    Transcript,
198    #[serde(rename = "tool-calls")]
199    ToolCalls,
200    #[serde(rename = "tool-calls-result")]
201    ToolCallsResult,
202    #[serde(rename = "transfer-update")]
203    TransferUpdate,
204    #[serde(rename = "user-interrupted")]
205    UserInterrupted,
206    #[serde(rename = "voice-input")]
207    VoiceInput,
208}
209
210impl Default for ClientMessages {
211    fn default() -> ClientMessages {
212        Self::ConversationUpdate
213    }
214}
215/// 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.
216#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
217pub enum ServerMessages {
218    #[serde(rename = "conversation-update")]
219    ConversationUpdate,
220    #[serde(rename = "end-of-call-report")]
221    EndOfCallReport,
222    #[serde(rename = "function-call")]
223    FunctionCall,
224    #[serde(rename = "hang")]
225    Hang,
226    #[serde(rename = "language-changed")]
227    LanguageChanged,
228    #[serde(rename = "language-change-detected")]
229    LanguageChangeDetected,
230    #[serde(rename = "model-output")]
231    ModelOutput,
232    #[serde(rename = "phone-call-control")]
233    PhoneCallControl,
234    #[serde(rename = "speech-update")]
235    SpeechUpdate,
236    #[serde(rename = "status-update")]
237    StatusUpdate,
238    #[serde(rename = "transcript")]
239    Transcript,
240    #[serde(rename = "transcript[transcriptType=\"final\"]")]
241    TranscriptLeftSquareBracketTranscriptTypeEqualDoubleQuoteFinalDoubleQuoteRightSquareBracket,
242    #[serde(rename = "tool-calls")]
243    ToolCalls,
244    #[serde(rename = "transfer-destination-request")]
245    TransferDestinationRequest,
246    #[serde(rename = "transfer-update")]
247    TransferUpdate,
248    #[serde(rename = "user-interrupted")]
249    UserInterrupted,
250    #[serde(rename = "voice-input")]
251    VoiceInput,
252}
253
254impl Default for ServerMessages {
255    fn default() -> ServerMessages {
256        Self::ConversationUpdate
257    }
258}
259/// This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
260#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
261pub enum BackgroundSound {
262    #[serde(rename = "off")]
263    Off,
264    #[serde(rename = "office")]
265    Office,
266}
267
268impl Default for BackgroundSound {
269    fn default() -> BackgroundSound {
270        Self::Off
271    }
272}