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