This repository was archived by the owner on Oct 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAssistant.java
More file actions
1959 lines (1686 loc) · 83.3 KB
/
Copy pathAssistant.java
File metadata and controls
1959 lines (1686 loc) · 83.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.vapi.api.types;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.vapi.api.core.ObjectMappers;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Assistant.Builder.class)
public final class Assistant {
private final Optional<AssistantTranscriber> transcriber;
private final Optional<AssistantModel> model;
private final Optional<AssistantVoice> voice;
private final Optional<String> firstMessage;
private final Optional<Boolean> firstMessageInterruptionsEnabled;
private final Optional<AssistantFirstMessageMode> firstMessageMode;
private final Optional<AssistantVoicemailDetection> voicemailDetection;
private final Optional<List<AssistantClientMessagesItem>> clientMessages;
private final Optional<List<AssistantServerMessagesItem>> serverMessages;
private final Optional<Double> silenceTimeoutSeconds;
private final Optional<Double> maxDurationSeconds;
private final Optional<AssistantBackgroundSound> backgroundSound;
private final Optional<Boolean> backgroundDenoisingEnabled;
private final Optional<Boolean> modelOutputInMessagesEnabled;
private final Optional<List<TransportConfigurationTwilio>> transportConfigurations;
private final Optional<LangfuseObservabilityPlan> observabilityPlan;
private final Optional<List<AssistantCredentialsItem>> credentials;
private final Optional<List<AssistantHooksItem>> hooks;
private final Optional<String> name;
private final Optional<String> voicemailMessage;
private final Optional<String> endCallMessage;
private final Optional<List<String>> endCallPhrases;
private final Optional<CompliancePlan> compliancePlan;
private final Optional<Map<String, Object>> metadata;
private final Optional<BackgroundSpeechDenoisingPlan> backgroundSpeechDenoisingPlan;
private final Optional<AnalysisPlan> analysisPlan;
private final Optional<ArtifactPlan> artifactPlan;
private final Optional<MessagePlan> messagePlan;
private final Optional<StartSpeakingPlan> startSpeakingPlan;
private final Optional<StopSpeakingPlan> stopSpeakingPlan;
private final Optional<MonitorPlan> monitorPlan;
private final Optional<List<String>> credentialIds;
private final Optional<Server> server;
private final Optional<KeypadInputPlan> keypadInputPlan;
private final String id;
private final String orgId;
private final OffsetDateTime createdAt;
private final OffsetDateTime updatedAt;
private final Map<String, Object> additionalProperties;
private Assistant(
Optional<AssistantTranscriber> transcriber,
Optional<AssistantModel> model,
Optional<AssistantVoice> voice,
Optional<String> firstMessage,
Optional<Boolean> firstMessageInterruptionsEnabled,
Optional<AssistantFirstMessageMode> firstMessageMode,
Optional<AssistantVoicemailDetection> voicemailDetection,
Optional<List<AssistantClientMessagesItem>> clientMessages,
Optional<List<AssistantServerMessagesItem>> serverMessages,
Optional<Double> silenceTimeoutSeconds,
Optional<Double> maxDurationSeconds,
Optional<AssistantBackgroundSound> backgroundSound,
Optional<Boolean> backgroundDenoisingEnabled,
Optional<Boolean> modelOutputInMessagesEnabled,
Optional<List<TransportConfigurationTwilio>> transportConfigurations,
Optional<LangfuseObservabilityPlan> observabilityPlan,
Optional<List<AssistantCredentialsItem>> credentials,
Optional<List<AssistantHooksItem>> hooks,
Optional<String> name,
Optional<String> voicemailMessage,
Optional<String> endCallMessage,
Optional<List<String>> endCallPhrases,
Optional<CompliancePlan> compliancePlan,
Optional<Map<String, Object>> metadata,
Optional<BackgroundSpeechDenoisingPlan> backgroundSpeechDenoisingPlan,
Optional<AnalysisPlan> analysisPlan,
Optional<ArtifactPlan> artifactPlan,
Optional<MessagePlan> messagePlan,
Optional<StartSpeakingPlan> startSpeakingPlan,
Optional<StopSpeakingPlan> stopSpeakingPlan,
Optional<MonitorPlan> monitorPlan,
Optional<List<String>> credentialIds,
Optional<Server> server,
Optional<KeypadInputPlan> keypadInputPlan,
String id,
String orgId,
OffsetDateTime createdAt,
OffsetDateTime updatedAt,
Map<String, Object> additionalProperties) {
this.transcriber = transcriber;
this.model = model;
this.voice = voice;
this.firstMessage = firstMessage;
this.firstMessageInterruptionsEnabled = firstMessageInterruptionsEnabled;
this.firstMessageMode = firstMessageMode;
this.voicemailDetection = voicemailDetection;
this.clientMessages = clientMessages;
this.serverMessages = serverMessages;
this.silenceTimeoutSeconds = silenceTimeoutSeconds;
this.maxDurationSeconds = maxDurationSeconds;
this.backgroundSound = backgroundSound;
this.backgroundDenoisingEnabled = backgroundDenoisingEnabled;
this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled;
this.transportConfigurations = transportConfigurations;
this.observabilityPlan = observabilityPlan;
this.credentials = credentials;
this.hooks = hooks;
this.name = name;
this.voicemailMessage = voicemailMessage;
this.endCallMessage = endCallMessage;
this.endCallPhrases = endCallPhrases;
this.compliancePlan = compliancePlan;
this.metadata = metadata;
this.backgroundSpeechDenoisingPlan = backgroundSpeechDenoisingPlan;
this.analysisPlan = analysisPlan;
this.artifactPlan = artifactPlan;
this.messagePlan = messagePlan;
this.startSpeakingPlan = startSpeakingPlan;
this.stopSpeakingPlan = stopSpeakingPlan;
this.monitorPlan = monitorPlan;
this.credentialIds = credentialIds;
this.server = server;
this.keypadInputPlan = keypadInputPlan;
this.id = id;
this.orgId = orgId;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
this.additionalProperties = additionalProperties;
}
/**
* @return These are the options for the assistant's transcriber.
*/
@JsonProperty("transcriber")
public Optional<AssistantTranscriber> getTranscriber() {
return transcriber;
}
/**
* @return These are the options for the assistant's LLM.
*/
@JsonProperty("model")
public Optional<AssistantModel> getModel() {
return model;
}
/**
* @return These are the options for the assistant's voice.
*/
@JsonProperty("voice")
public Optional<AssistantVoice> getVoice() {
return voice;
}
/**
* @return This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).
* <p>If unspecified, assistant will wait for user to speak and use the model to respond once they speak.</p>
*/
@JsonProperty("firstMessage")
public Optional<String> getFirstMessage() {
return firstMessage;
}
@JsonProperty("firstMessageInterruptionsEnabled")
public Optional<Boolean> getFirstMessageInterruptionsEnabled() {
return firstMessageInterruptionsEnabled;
}
/**
* @return This is the mode for the first message. Default is 'assistant-speaks-first'.
* <p>Use:</p>
* <ul>
* <li>'assistant-speaks-first' to have the assistant speak first.</li>
* <li>'assistant-waits-for-user' to have the assistant wait for the user to speak first.</li>
* <li>'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. (<code>assistant.model.messages</code> at call start, <code>call.messages</code> at squad transfer points).</li>
* </ul>
* <p>@default 'assistant-speaks-first'</p>
*/
@JsonProperty("firstMessageMode")
public Optional<AssistantFirstMessageMode> getFirstMessageMode() {
return firstMessageMode;
}
/**
* @return 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.
*/
@JsonProperty("voicemailDetection")
public Optional<AssistantVoicemailDetection> getVoicemailDetection() {
return voicemailDetection;
}
/**
* @return 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.
*/
@JsonProperty("clientMessages")
public Optional<List<AssistantClientMessagesItem>> getClientMessages() {
return clientMessages;
}
/**
* @return 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.
*/
@JsonProperty("serverMessages")
public Optional<List<AssistantServerMessagesItem>> getServerMessages() {
return serverMessages;
}
/**
* @return How many seconds of silence to wait before ending the call. Defaults to 30.
* <p>@default 30</p>
*/
@JsonProperty("silenceTimeoutSeconds")
public Optional<Double> getSilenceTimeoutSeconds() {
return silenceTimeoutSeconds;
}
/**
* @return This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.
* <p>@default 600 (10 minutes)</p>
*/
@JsonProperty("maxDurationSeconds")
public Optional<Double> getMaxDurationSeconds() {
return maxDurationSeconds;
}
/**
* @return This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
* You can also provide a custom sound by providing a URL to an audio file.
*/
@JsonProperty("backgroundSound")
public Optional<AssistantBackgroundSound> getBackgroundSound() {
return backgroundSound;
}
/**
* @return This enables filtering of noise and background speech while the user is talking.
* <p>Default <code>false</code> while in beta.</p>
* <p>@default false</p>
*/
@JsonProperty("backgroundDenoisingEnabled")
public Optional<Boolean> getBackgroundDenoisingEnabled() {
return backgroundDenoisingEnabled;
}
/**
* @return This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.
* <p>Default <code>false</code> while in beta.</p>
* <p>@default false</p>
*/
@JsonProperty("modelOutputInMessagesEnabled")
public Optional<Boolean> getModelOutputInMessagesEnabled() {
return modelOutputInMessagesEnabled;
}
/**
* @return 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.
*/
@JsonProperty("transportConfigurations")
public Optional<List<TransportConfigurationTwilio>> getTransportConfigurations() {
return transportConfigurations;
}
/**
* @return This is the plan for observability of assistant's calls.
* <p>Currently, only Langfuse is supported.</p>
*/
@JsonProperty("observabilityPlan")
public Optional<LangfuseObservabilityPlan> getObservabilityPlan() {
return observabilityPlan;
}
/**
* @return 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.
*/
@JsonProperty("credentials")
public Optional<List<AssistantCredentialsItem>> getCredentials() {
return credentials;
}
/**
* @return This is a set of actions that will be performed on certain events.
*/
@JsonProperty("hooks")
public Optional<List<AssistantHooksItem>> getHooks() {
return hooks;
}
/**
* @return This is the name of the assistant.
* <p>This is required when you want to transfer between assistants in a call.</p>
*/
@JsonProperty("name")
public Optional<String> getName() {
return name;
}
/**
* @return This is the message that the assistant will say if the call is forwarded to voicemail.
* <p>If unspecified, it will hang up.</p>
*/
@JsonProperty("voicemailMessage")
public Optional<String> getVoicemailMessage() {
return voicemailMessage;
}
/**
* @return This is the message that the assistant will say if it ends the call.
* <p>If unspecified, it will hang up without saying anything.</p>
*/
@JsonProperty("endCallMessage")
public Optional<String> getEndCallMessage() {
return endCallMessage;
}
/**
* @return This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.
*/
@JsonProperty("endCallPhrases")
public Optional<List<String>> getEndCallPhrases() {
return endCallPhrases;
}
@JsonProperty("compliancePlan")
public Optional<CompliancePlan> getCompliancePlan() {
return compliancePlan;
}
/**
* @return This is for metadata you want to store on the assistant.
*/
@JsonProperty("metadata")
public Optional<Map<String, Object>> getMetadata() {
return metadata;
}
/**
* @return This enables filtering of noise and background speech while the user is talking.
* <p>Features:</p>
* <ul>
* <li>Smart denoising using Krisp</li>
* <li>Fourier denoising</li>
* </ul>
* <p>Smart denoising can be combined with or used independently of Fourier denoising.</p>
* <p>Order of precedence:</p>
* <ul>
* <li>Smart denoising</li>
* <li>Fourier denoising</li>
* </ul>
*/
@JsonProperty("backgroundSpeechDenoisingPlan")
public Optional<BackgroundSpeechDenoisingPlan> getBackgroundSpeechDenoisingPlan() {
return backgroundSpeechDenoisingPlan;
}
/**
* @return This is the plan for analysis of assistant's calls. Stored in <code>call.analysis</code>.
*/
@JsonProperty("analysisPlan")
public Optional<AnalysisPlan> getAnalysisPlan() {
return analysisPlan;
}
/**
* @return This is the plan for artifacts generated during assistant's calls. Stored in <code>call.artifact</code>.
*/
@JsonProperty("artifactPlan")
public Optional<ArtifactPlan> getArtifactPlan() {
return artifactPlan;
}
/**
* @return This is the plan for static predefined messages that can be spoken by the assistant during the call, like <code>idleMessages</code>.
* <p>Note: <code>firstMessage</code>, <code>voicemailMessage</code>, and <code>endCallMessage</code> are currently at the root level. They will be moved to <code>messagePlan</code> in the future, but will remain backwards compatible.</p>
*/
@JsonProperty("messagePlan")
public Optional<MessagePlan> getMessagePlan() {
return messagePlan;
}
/**
* @return This is the plan for when the assistant should start talking.
* <p>You should configure this if you're running into these issues:</p>
* <ul>
* <li>The assistant is too slow to start talking after the customer is done speaking.</li>
* <li>The assistant is too fast to start talking after the customer is done speaking.</li>
* <li>The assistant is so fast that it's actually interrupting the customer.</li>
* </ul>
*/
@JsonProperty("startSpeakingPlan")
public Optional<StartSpeakingPlan> getStartSpeakingPlan() {
return startSpeakingPlan;
}
/**
* @return This is the plan for when assistant should stop talking on customer interruption.
* <p>You should configure this if you're running into these issues:</p>
* <ul>
* <li>The assistant is too slow to recognize customer's interruption.</li>
* <li>The assistant is too fast to recognize customer's interruption.</li>
* <li>The assistant is getting interrupted by phrases that are just acknowledgments.</li>
* <li>The assistant is getting interrupted by background noises.</li>
* <li>The assistant is not properly stopping -- it starts talking right after getting interrupted.</li>
* </ul>
*/
@JsonProperty("stopSpeakingPlan")
public Optional<StopSpeakingPlan> getStopSpeakingPlan() {
return stopSpeakingPlan;
}
/**
* @return This is the plan for real-time monitoring of the assistant's calls.
* <p>Usage:</p>
* <ul>
* <li>To enable live listening of the assistant's calls, set <code>monitorPlan.listenEnabled</code> to <code>true</code>.</li>
* <li>To enable live control of the assistant's calls, set <code>monitorPlan.controlEnabled</code> to <code>true</code>.</li>
* </ul>
*/
@JsonProperty("monitorPlan")
public Optional<MonitorPlan> getMonitorPlan() {
return monitorPlan;
}
/**
* @return 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.
*/
@JsonProperty("credentialIds")
public Optional<List<String>> getCredentialIds() {
return credentialIds;
}
/**
* @return This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.
* <p>The order of precedence is:</p>
* <ol>
* <li>assistant.server.url</li>
* <li>phoneNumber.serverUrl</li>
* <li>org.serverUrl</li>
* </ol>
*/
@JsonProperty("server")
public Optional<Server> getServer() {
return server;
}
@JsonProperty("keypadInputPlan")
public Optional<KeypadInputPlan> getKeypadInputPlan() {
return keypadInputPlan;
}
/**
* @return This is the unique identifier for the assistant.
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return This is the unique identifier for the org that this assistant belongs to.
*/
@JsonProperty("orgId")
public String getOrgId() {
return orgId;
}
/**
* @return This is the ISO 8601 date-time string of when the assistant was created.
*/
@JsonProperty("createdAt")
public OffsetDateTime getCreatedAt() {
return createdAt;
}
/**
* @return This is the ISO 8601 date-time string of when the assistant was last updated.
*/
@JsonProperty("updatedAt")
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Assistant && equalTo((Assistant) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Assistant other) {
return transcriber.equals(other.transcriber)
&& model.equals(other.model)
&& voice.equals(other.voice)
&& firstMessage.equals(other.firstMessage)
&& firstMessageInterruptionsEnabled.equals(other.firstMessageInterruptionsEnabled)
&& firstMessageMode.equals(other.firstMessageMode)
&& voicemailDetection.equals(other.voicemailDetection)
&& clientMessages.equals(other.clientMessages)
&& serverMessages.equals(other.serverMessages)
&& silenceTimeoutSeconds.equals(other.silenceTimeoutSeconds)
&& maxDurationSeconds.equals(other.maxDurationSeconds)
&& backgroundSound.equals(other.backgroundSound)
&& backgroundDenoisingEnabled.equals(other.backgroundDenoisingEnabled)
&& modelOutputInMessagesEnabled.equals(other.modelOutputInMessagesEnabled)
&& transportConfigurations.equals(other.transportConfigurations)
&& observabilityPlan.equals(other.observabilityPlan)
&& credentials.equals(other.credentials)
&& hooks.equals(other.hooks)
&& name.equals(other.name)
&& voicemailMessage.equals(other.voicemailMessage)
&& endCallMessage.equals(other.endCallMessage)
&& endCallPhrases.equals(other.endCallPhrases)
&& compliancePlan.equals(other.compliancePlan)
&& metadata.equals(other.metadata)
&& backgroundSpeechDenoisingPlan.equals(other.backgroundSpeechDenoisingPlan)
&& analysisPlan.equals(other.analysisPlan)
&& artifactPlan.equals(other.artifactPlan)
&& messagePlan.equals(other.messagePlan)
&& startSpeakingPlan.equals(other.startSpeakingPlan)
&& stopSpeakingPlan.equals(other.stopSpeakingPlan)
&& monitorPlan.equals(other.monitorPlan)
&& credentialIds.equals(other.credentialIds)
&& server.equals(other.server)
&& keypadInputPlan.equals(other.keypadInputPlan)
&& id.equals(other.id)
&& orgId.equals(other.orgId)
&& createdAt.equals(other.createdAt)
&& updatedAt.equals(other.updatedAt);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.transcriber,
this.model,
this.voice,
this.firstMessage,
this.firstMessageInterruptionsEnabled,
this.firstMessageMode,
this.voicemailDetection,
this.clientMessages,
this.serverMessages,
this.silenceTimeoutSeconds,
this.maxDurationSeconds,
this.backgroundSound,
this.backgroundDenoisingEnabled,
this.modelOutputInMessagesEnabled,
this.transportConfigurations,
this.observabilityPlan,
this.credentials,
this.hooks,
this.name,
this.voicemailMessage,
this.endCallMessage,
this.endCallPhrases,
this.compliancePlan,
this.metadata,
this.backgroundSpeechDenoisingPlan,
this.analysisPlan,
this.artifactPlan,
this.messagePlan,
this.startSpeakingPlan,
this.stopSpeakingPlan,
this.monitorPlan,
this.credentialIds,
this.server,
this.keypadInputPlan,
this.id,
this.orgId,
this.createdAt,
this.updatedAt);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>This is the unique identifier for the assistant.</p>
*/
OrgIdStage id(@NotNull String id);
Builder from(Assistant other);
}
public interface OrgIdStage {
/**
* <p>This is the unique identifier for the org that this assistant belongs to.</p>
*/
CreatedAtStage orgId(@NotNull String orgId);
}
public interface CreatedAtStage {
/**
* <p>This is the ISO 8601 date-time string of when the assistant was created.</p>
*/
UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt);
}
public interface UpdatedAtStage {
/**
* <p>This is the ISO 8601 date-time string of when the assistant was last updated.</p>
*/
_FinalStage updatedAt(@NotNull OffsetDateTime updatedAt);
}
public interface _FinalStage {
Assistant build();
/**
* <p>These are the options for the assistant's transcriber.</p>
*/
_FinalStage transcriber(Optional<AssistantTranscriber> transcriber);
_FinalStage transcriber(AssistantTranscriber transcriber);
/**
* <p>These are the options for the assistant's LLM.</p>
*/
_FinalStage model(Optional<AssistantModel> model);
_FinalStage model(AssistantModel model);
/**
* <p>These are the options for the assistant's voice.</p>
*/
_FinalStage voice(Optional<AssistantVoice> voice);
_FinalStage voice(AssistantVoice voice);
/**
* <p>This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).</p>
* <p>If unspecified, assistant will wait for user to speak and use the model to respond once they speak.</p>
*/
_FinalStage firstMessage(Optional<String> firstMessage);
_FinalStage firstMessage(String firstMessage);
_FinalStage firstMessageInterruptionsEnabled(Optional<Boolean> firstMessageInterruptionsEnabled);
_FinalStage firstMessageInterruptionsEnabled(Boolean firstMessageInterruptionsEnabled);
/**
* <p>This is the mode for the first message. Default is 'assistant-speaks-first'.</p>
* <p>Use:</p>
* <ul>
* <li>'assistant-speaks-first' to have the assistant speak first.</li>
* <li>'assistant-waits-for-user' to have the assistant wait for the user to speak first.</li>
* <li>'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. (<code>assistant.model.messages</code> at call start, <code>call.messages</code> at squad transfer points).</li>
* </ul>
* <p>@default 'assistant-speaks-first'</p>
*/
_FinalStage firstMessageMode(Optional<AssistantFirstMessageMode> firstMessageMode);
_FinalStage firstMessageMode(AssistantFirstMessageMode firstMessageMode);
/**
* <p>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.</p>
*/
_FinalStage voicemailDetection(Optional<AssistantVoicemailDetection> voicemailDetection);
_FinalStage voicemailDetection(AssistantVoicemailDetection voicemailDetection);
/**
* <p>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.</p>
*/
_FinalStage clientMessages(Optional<List<AssistantClientMessagesItem>> clientMessages);
_FinalStage clientMessages(List<AssistantClientMessagesItem> clientMessages);
/**
* <p>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.</p>
*/
_FinalStage serverMessages(Optional<List<AssistantServerMessagesItem>> serverMessages);
_FinalStage serverMessages(List<AssistantServerMessagesItem> serverMessages);
/**
* <p>How many seconds of silence to wait before ending the call. Defaults to 30.</p>
* <p>@default 30</p>
*/
_FinalStage silenceTimeoutSeconds(Optional<Double> silenceTimeoutSeconds);
_FinalStage silenceTimeoutSeconds(Double silenceTimeoutSeconds);
/**
* <p>This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.</p>
* <p>@default 600 (10 minutes)</p>
*/
_FinalStage maxDurationSeconds(Optional<Double> maxDurationSeconds);
_FinalStage maxDurationSeconds(Double maxDurationSeconds);
/**
* <p>This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.
* You can also provide a custom sound by providing a URL to an audio file.</p>
*/
_FinalStage backgroundSound(Optional<AssistantBackgroundSound> backgroundSound);
_FinalStage backgroundSound(AssistantBackgroundSound backgroundSound);
/**
* <p>This enables filtering of noise and background speech while the user is talking.</p>
* <p>Default <code>false</code> while in beta.</p>
* <p>@default false</p>
*/
_FinalStage backgroundDenoisingEnabled(Optional<Boolean> backgroundDenoisingEnabled);
_FinalStage backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled);
/**
* <p>This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.</p>
* <p>Default <code>false</code> while in beta.</p>
* <p>@default false</p>
*/
_FinalStage modelOutputInMessagesEnabled(Optional<Boolean> modelOutputInMessagesEnabled);
_FinalStage modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled);
/**
* <p>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.</p>
*/
_FinalStage transportConfigurations(Optional<List<TransportConfigurationTwilio>> transportConfigurations);
_FinalStage transportConfigurations(List<TransportConfigurationTwilio> transportConfigurations);
/**
* <p>This is the plan for observability of assistant's calls.</p>
* <p>Currently, only Langfuse is supported.</p>
*/
_FinalStage observabilityPlan(Optional<LangfuseObservabilityPlan> observabilityPlan);
_FinalStage observabilityPlan(LangfuseObservabilityPlan observabilityPlan);
/**
* <p>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.</p>
*/
_FinalStage credentials(Optional<List<AssistantCredentialsItem>> credentials);
_FinalStage credentials(List<AssistantCredentialsItem> credentials);
/**
* <p>This is a set of actions that will be performed on certain events.</p>
*/
_FinalStage hooks(Optional<List<AssistantHooksItem>> hooks);
_FinalStage hooks(List<AssistantHooksItem> hooks);
/**
* <p>This is the name of the assistant.</p>
* <p>This is required when you want to transfer between assistants in a call.</p>
*/
_FinalStage name(Optional<String> name);
_FinalStage name(String name);
/**
* <p>This is the message that the assistant will say if the call is forwarded to voicemail.</p>
* <p>If unspecified, it will hang up.</p>
*/
_FinalStage voicemailMessage(Optional<String> voicemailMessage);
_FinalStage voicemailMessage(String voicemailMessage);
/**
* <p>This is the message that the assistant will say if it ends the call.</p>
* <p>If unspecified, it will hang up without saying anything.</p>
*/
_FinalStage endCallMessage(Optional<String> endCallMessage);
_FinalStage endCallMessage(String endCallMessage);
/**
* <p>This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.</p>
*/
_FinalStage endCallPhrases(Optional<List<String>> endCallPhrases);
_FinalStage endCallPhrases(List<String> endCallPhrases);
_FinalStage compliancePlan(Optional<CompliancePlan> compliancePlan);
_FinalStage compliancePlan(CompliancePlan compliancePlan);
/**
* <p>This is for metadata you want to store on the assistant.</p>
*/
_FinalStage metadata(Optional<Map<String, Object>> metadata);
_FinalStage metadata(Map<String, Object> metadata);
/**
* <p>This enables filtering of noise and background speech while the user is talking.</p>
* <p>Features:</p>
* <ul>
* <li>Smart denoising using Krisp</li>
* <li>Fourier denoising</li>
* </ul>
* <p>Smart denoising can be combined with or used independently of Fourier denoising.</p>
* <p>Order of precedence:</p>
* <ul>
* <li>Smart denoising</li>
* <li>Fourier denoising</li>
* </ul>
*/
_FinalStage backgroundSpeechDenoisingPlan(
Optional<BackgroundSpeechDenoisingPlan> backgroundSpeechDenoisingPlan);
_FinalStage backgroundSpeechDenoisingPlan(BackgroundSpeechDenoisingPlan backgroundSpeechDenoisingPlan);
/**
* <p>This is the plan for analysis of assistant's calls. Stored in <code>call.analysis</code>.</p>
*/
_FinalStage analysisPlan(Optional<AnalysisPlan> analysisPlan);
_FinalStage analysisPlan(AnalysisPlan analysisPlan);
/**
* <p>This is the plan for artifacts generated during assistant's calls. Stored in <code>call.artifact</code>.</p>
*/
_FinalStage artifactPlan(Optional<ArtifactPlan> artifactPlan);
_FinalStage artifactPlan(ArtifactPlan artifactPlan);
/**
* <p>This is the plan for static predefined messages that can be spoken by the assistant during the call, like <code>idleMessages</code>.</p>
* <p>Note: <code>firstMessage</code>, <code>voicemailMessage</code>, and <code>endCallMessage</code> are currently at the root level. They will be moved to <code>messagePlan</code> in the future, but will remain backwards compatible.</p>
*/
_FinalStage messagePlan(Optional<MessagePlan> messagePlan);
_FinalStage messagePlan(MessagePlan messagePlan);
/**
* <p>This is the plan for when the assistant should start talking.</p>
* <p>You should configure this if you're running into these issues:</p>
* <ul>
* <li>The assistant is too slow to start talking after the customer is done speaking.</li>
* <li>The assistant is too fast to start talking after the customer is done speaking.</li>
* <li>The assistant is so fast that it's actually interrupting the customer.</li>
* </ul>
*/
_FinalStage startSpeakingPlan(Optional<StartSpeakingPlan> startSpeakingPlan);
_FinalStage startSpeakingPlan(StartSpeakingPlan startSpeakingPlan);
/**
* <p>This is the plan for when assistant should stop talking on customer interruption.</p>
* <p>You should configure this if you're running into these issues:</p>
* <ul>
* <li>The assistant is too slow to recognize customer's interruption.</li>
* <li>The assistant is too fast to recognize customer's interruption.</li>
* <li>The assistant is getting interrupted by phrases that are just acknowledgments.</li>
* <li>The assistant is getting interrupted by background noises.</li>
* <li>The assistant is not properly stopping -- it starts talking right after getting interrupted.</li>
* </ul>
*/
_FinalStage stopSpeakingPlan(Optional<StopSpeakingPlan> stopSpeakingPlan);
_FinalStage stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan);
/**
* <p>This is the plan for real-time monitoring of the assistant's calls.</p>
* <p>Usage:</p>
* <ul>
* <li>To enable live listening of the assistant's calls, set <code>monitorPlan.listenEnabled</code> to <code>true</code>.</li>
* <li>To enable live control of the assistant's calls, set <code>monitorPlan.controlEnabled</code> to <code>true</code>.</li>
* </ul>
*/
_FinalStage monitorPlan(Optional<MonitorPlan> monitorPlan);
_FinalStage monitorPlan(MonitorPlan monitorPlan);
/**
* <p>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.</p>
*/
_FinalStage credentialIds(Optional<List<String>> credentialIds);
_FinalStage credentialIds(List<String> credentialIds);
/**
* <p>This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.</p>
* <p>The order of precedence is:</p>
* <ol>
* <li>assistant.server.url</li>
* <li>phoneNumber.serverUrl</li>
* <li>org.serverUrl</li>
* </ol>
*/
_FinalStage server(Optional<Server> server);
_FinalStage server(Server server);
_FinalStage keypadInputPlan(Optional<KeypadInputPlan> keypadInputPlan);
_FinalStage keypadInputPlan(KeypadInputPlan keypadInputPlan);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage {
private String id;
private String orgId;
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
private Optional<KeypadInputPlan> keypadInputPlan = Optional.empty();
private Optional<Server> server = Optional.empty();
private Optional<List<String>> credentialIds = Optional.empty();
private Optional<MonitorPlan> monitorPlan = Optional.empty();
private Optional<StopSpeakingPlan> stopSpeakingPlan = Optional.empty();
private Optional<StartSpeakingPlan> startSpeakingPlan = Optional.empty();
private Optional<MessagePlan> messagePlan = Optional.empty();
private Optional<ArtifactPlan> artifactPlan = Optional.empty();
private Optional<AnalysisPlan> analysisPlan = Optional.empty();
private Optional<BackgroundSpeechDenoisingPlan> backgroundSpeechDenoisingPlan = Optional.empty();
private Optional<Map<String, Object>> metadata = Optional.empty();
private Optional<CompliancePlan> compliancePlan = Optional.empty();
private Optional<List<String>> endCallPhrases = Optional.empty();
private Optional<String> endCallMessage = Optional.empty();