-
Notifications
You must be signed in to change notification settings - Fork 55
/
api.ts
10562 lines (10240 loc) · 343 KB
/
api.ts
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
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
export interface DeepgramTranscriber {
/** This is the transcription provider that will be used. */
provider: 'deepgram';
/** This is the Deepgram model that will be used. A list of models can be found here: https://developers.deepgram.com/docs/models-languages-overview */
model?:
| 'nova-2'
| 'nova-2-general'
| 'nova-2-meeting'
| 'nova-2-phonecall'
| 'nova-2-finance'
| 'nova-2-conversationalai'
| 'nova-2-voicemail'
| 'nova-2-video'
| 'nova-2-medical'
| 'nova-2-drivethru'
| 'nova-2-automotive'
| 'nova'
| 'nova-general'
| 'nova-phonecall'
| 'nova-medical'
| 'enhanced'
| 'enhanced-general'
| 'enhanced-meeting'
| 'enhanced-phonecall'
| 'enhanced-finance'
| 'base'
| 'base-general'
| 'base-meeting'
| 'base-phonecall'
| 'base-finance'
| 'base-conversationalai'
| 'base-voicemail'
| 'base-video'
| string;
/** This is the language that will be set for the transcription. The list of languages Deepgram supports can be found here: https://developers.deepgram.com/docs/models-languages-overview */
language?:
| 'bg'
| 'ca'
| 'cs'
| 'da'
| 'da-DK'
| 'de'
| 'de-CH'
| 'el'
| 'en'
| 'en-AU'
| 'en-GB'
| 'en-IN'
| 'en-NZ'
| 'en-US'
| 'es'
| 'es-419'
| 'es-LATAM'
| 'et'
| 'fi'
| 'fr'
| 'fr-CA'
| 'hi'
| 'hi-Latn'
| 'hu'
| 'id'
| 'it'
| 'ja'
| 'ko'
| 'ko-KR'
| 'lt'
| 'lv'
| 'ms'
| 'nl'
| 'nl-BE'
| 'no'
| 'pl'
| 'pt'
| 'pt-BR'
| 'ro'
| 'ru'
| 'sk'
| 'sv'
| 'sv-SE'
| 'ta'
| 'taq'
| 'th'
| 'th-TH'
| 'tr'
| 'uk'
| 'vi'
| 'zh'
| 'zh-CN'
| 'zh-Hans'
| 'zh-Hant'
| 'zh-TW';
/**
* This will be use smart format option provided by Deepgram. It's default disabled because it can sometimes format numbers as times sometimes but it's getting better.
* @example false
*/
smartFormat?: boolean;
/** These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. */
keywords?: string[];
}
export interface TalkscriberTranscriber {
/** This is the transcription provider that will be used. */
provider: 'talkscriber';
/** This is the model that will be used for the transcription. */
model?: 'whisper';
/** This is the language that will be set for the transcription. The list of languages Whisper supports can be found here: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py */
language?:
| 'en'
| 'zh'
| 'de'
| 'es'
| 'ru'
| 'ko'
| 'fr'
| 'ja'
| 'pt'
| 'tr'
| 'pl'
| 'ca'
| 'nl'
| 'ar'
| 'sv'
| 'it'
| 'id'
| 'hi'
| 'fi'
| 'vi'
| 'he'
| 'uk'
| 'el'
| 'ms'
| 'cs'
| 'ro'
| 'da'
| 'hu'
| 'ta'
| 'no'
| 'th'
| 'ur'
| 'hr'
| 'bg'
| 'lt'
| 'la'
| 'mi'
| 'ml'
| 'cy'
| 'sk'
| 'te'
| 'fa'
| 'lv'
| 'bn'
| 'sr'
| 'az'
| 'sl'
| 'kn'
| 'et'
| 'mk'
| 'br'
| 'eu'
| 'is'
| 'hy'
| 'ne'
| 'mn'
| 'bs'
| 'kk'
| 'sq'
| 'sw'
| 'gl'
| 'mr'
| 'pa'
| 'si'
| 'km'
| 'sn'
| 'yo'
| 'so'
| 'af'
| 'oc'
| 'ka'
| 'be'
| 'tg'
| 'sd'
| 'gu'
| 'am'
| 'yi'
| 'lo'
| 'uz'
| 'fo'
| 'ht'
| 'ps'
| 'tk'
| 'nn'
| 'mt'
| 'sa'
| 'lb'
| 'my'
| 'bo'
| 'tl'
| 'mg'
| 'as'
| 'tt'
| 'haw'
| 'ln'
| 'ha'
| 'ba'
| 'jw'
| 'su'
| 'yue';
}
export interface GladiaTranscriber {
/** This is the transcription provider that will be used. */
provider: 'gladia';
/** This is the Gladia model that will be used. Default is 'fast' */
model?: 'fast' | 'accurate';
/** Defines how the transcription model detects the audio language. Default value is 'automatic single language'. */
languageBehaviour?:
| 'manual'
| 'automatic single language'
| 'automatic multiple languages';
/** Defines the language to use for the transcription. Required when languageBehaviour is 'manual'. */
language?:
| 'af'
| 'sq'
| 'am'
| 'ar'
| 'hy'
| 'as'
| 'az'
| 'ba'
| 'eu'
| 'be'
| 'bn'
| 'bs'
| 'br'
| 'bg'
| 'ca'
| 'zh'
| 'hr'
| 'cs'
| 'da'
| 'nl'
| 'en'
| 'et'
| 'fo'
| 'fi'
| 'fr'
| 'gl'
| 'ka'
| 'de'
| 'el'
| 'gu'
| 'ht'
| 'ha'
| 'haw'
| 'he'
| 'hi'
| 'hu'
| 'is'
| 'id'
| 'it'
| 'ja'
| 'jp'
| 'jv'
| 'kn'
| 'kk'
| 'km'
| 'ko'
| 'lo'
| 'la'
| 'lv'
| 'ln'
| 'lt'
| 'lb'
| 'mk'
| 'mg'
| 'ms'
| 'ml'
| 'mt'
| 'mi'
| 'mr'
| 'mn'
| 'mymr'
| 'ne'
| 'no'
| 'nn'
| 'oc'
| 'ps'
| 'fa'
| 'pl'
| 'pt'
| 'pa'
| 'ro'
| 'ru'
| 'sa'
| 'sr'
| 'sn'
| 'sd'
| 'si'
| 'sk'
| 'sl'
| 'so'
| 'es'
| 'su'
| 'sw'
| 'sv'
| 'tl'
| 'tg'
| 'ta'
| 'tt'
| 'te'
| 'th'
| 'bo'
| 'tr'
| 'tk'
| 'uk'
| 'ur'
| 'uz'
| 'vi'
| 'cy'
| 'yi'
| 'yo';
/**
* Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored.
* ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit.
* @maxLength 600
* @example "custom vocabulary"
*/
transcriptionHint?: string;
/**
* If prosody is true, you will get a transcription that can contain prosodies i.e. (laugh) (giggles) (malefic laugh) (toss) (music)… Default value is false.
* @example false
*/
prosody?: boolean;
/**
* If true, audio will be pre-processed to improve accuracy but latency will increase. Default value is false.
* @example false
*/
audioEnhancer?: boolean;
}
export interface Condition {
/** This is the name of the parameter that you want to check. */
param: string;
/** This is the value you want to compare against the parameter. */
value: string;
/** This is the operator you want to use to compare the parameter and value. */
operator: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
}
export interface ToolMessageStart {
/**
* This message is triggered when the tool call starts.
*
* This message is never triggered for async tools.
*
* If this message is not provided, one of the default filler messages "Hold on a sec", "One moment", "Just a sec", "Give me a moment" or "This'll just take a sec" will be used.
*/
type: 'request-start';
/** This is the content that the assistant says when this message is triggered. */
content: string;
/** This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. */
conditions?: Condition[];
}
export interface ToolMessageComplete {
/**
* This message is triggered when the tool call is complete.
*
* This message is triggered immediately without waiting for your server to respond for async tool calls.
*
* If this message is not provided, the model will be requested to respond.
*
* If this message is provided, only this message will be spoken and the model will not be requested to come up with a response. It's an exclusive OR.
*/
type: 'request-complete';
/**
* This is optional and defaults to "assistant".
*
* When role=assistant, `content` is said out loud.
*
* When role=system, `content` is passed to the model in a system message. Example:
* system: default one
* assistant:
* user:
* assistant:
* user:
* assistant:
* user:
* assistant: tool called
* tool: your server response
* <--- system prompt as hint
* ---> model generates response which is spoken
* This is useful when you want to provide a hint to the model about what to say next.
*/
role?: 'assistant' | 'system';
/** This is the content that the assistant says when this message is triggered. */
content: string;
/** This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. */
conditions?: Condition[];
}
export interface ToolMessageFailed {
/**
* This message is triggered when the tool call fails.
*
* This message is never triggered for async tool calls.
*
* If this message is not provided, the model will be requested to respond.
*
* If this message is provided, only this message will be spoken and the model will not be requested to come up with a response. It's an exclusive OR.
*/
type: 'request-failed';
/** This is the content that the assistant says when this message is triggered. */
content: string;
/** This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. */
conditions?: Condition[];
}
export interface ToolMessageDelayed {
/**
* This message is triggered when the tool call is delayed.
*
* There are the two things that can trigger this message:
* 1. The user talks with the assistant while your server is processing the request. Default is "Sorry, a few more seconds."
* 2. The server doesn't respond within `timingMilliseconds`.
*
* This message is never triggered for async tool calls.
*/
type: 'request-response-delayed';
/**
* The number of milliseconds to wait for the server response before saying this message.
* @min 100
* @max 20000
* @example 1000
*/
timingMilliseconds?: number;
/** This is the content that the assistant says when this message is triggered. */
content: string;
/** This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. */
conditions?: Condition[];
}
export interface JsonSchema {
/**
* This is the type of output you'd like.
*
* `string`, `number`, `integer`, `boolean` are the primitive types and should be obvious.
*
* `array` and `object` are more interesting and quite powerful. They allow you to define nested structures.
*
* For `array`, you can define the schema of the items in the array using the `items` property.
*
* For `object`, you can define the properties of the object using the `properties` property.
*/
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
/**
* This is required if the type is "array". This is the schema of the items in the array.
*
* This is of type JsonSchema. However, Swagger doesn't support circular references.
*/
items?: object;
/**
* This is required if the type is "object". This specifies the properties of the object.
*
* This is a map of string to JsonSchema. However, Swagger doesn't support circular references.
*/
properties?: object;
/** This is the description to help the model understand what it needs to output. */
description?: string;
/**
* This is a list of properties that are required.
*
* This only makes sense if the type is "object".
*/
required?: string[];
}
export interface OpenAIFunctionParameters {
/** This must be set to 'object'. It instructs the model to return a JSON object containing the function call properties. */
type: 'object';
/**
* This provides a description of the properties required by the function.
* JSON Schema can be used to specify expectations for each property.
* Refer to [this doc](https://ajv.js.org/json-schema.html#json-data-type) for a comprehensive guide on JSON Schema.
*/
properties: Record<string, JsonSchema>;
/** This specifies the properties that are required by the function. */
required?: string[];
}
export interface OpenAIFunction {
/**
* This is the the name of the function to be called.
*
* Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
* @maxLength 64
* @pattern /^[a-zA-Z0-9_-]{1,64}$/
*/
name: string;
/**
* This is the description of what the function does, used by the AI to choose when and how to call the function.
* @maxLength 1000
*/
description?: string;
/**
* These are the parameters the functions accepts, described as a JSON Schema object.
*
* See the [OpenAI guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema) for documentation about the format.
*
* Omitting parameters defines a function with an empty parameter list.
*/
parameters?: OpenAIFunctionParameters;
}
export interface Server {
/**
* This is the timeout in seconds for the request to your server. Defaults to 20 seconds.
*
* @default 20
* @min 1
* @max 20
* @example 20
*/
timeoutSeconds?: number;
/** API endpoint to send requests to. */
url: string;
/**
* This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.
*
* Same precedence logic as server.
*/
secret?: string;
}
export interface CreateDtmfToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "dtmf" for DTMF tool. */
type: 'dtmf';
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface CreateEndCallToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "endCall" for End Call tool. */
type: 'endCall';
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface CreateVoicemailToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "voicemail". This uses the model itself to determine if a voicemil was reached. Can be used alternatively/alongside with TwilioVoicemailDetection */
type: 'voicemail';
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface CreateFunctionToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "function" for Function tool. */
type: 'function';
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface GhlToolMetadata {
workflowId?: string;
locationId?: string;
}
export interface CreateGhlToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "ghl" for GHL tool. */
type: 'ghl';
metadata: GhlToolMetadata;
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface MakeToolMetadata {
scenarioId?: number;
triggerHookId?: number;
}
export interface CreateMakeToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
/** The type of tool. "make" for Make tool. */
type: 'make';
metadata: MakeToolMetadata;
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface AssistantTransferDestination {
type: 'assistant';
/** This is the assistant to transfer the call to. */
assistantName: string;
/** This is the message to say before transferring the call to the destination. */
message?: string;
/** This is the description of the destination, used by the AI to choose when and how to transfer the call. */
description?: string;
}
export interface NumberTransferDestination {
type: 'number';
/** This is the phone number to transfer the call to. */
number: string;
/** This is the message to say before transferring the call to the destination. */
message?: string;
/** This is the description of the destination, used by the AI to choose when and how to transfer the call. */
description?: string;
}
export interface SipTransferDestination {
type: 'sip';
/** This is the SIP URI to transfer the call to. */
sipUri: string;
/** This is the message to say before transferring the call to the destination. */
message?: string;
/** This is the description of the destination. This is used by the model to decide when to transfer the call to this destination. */
description?: string;
}
export interface CreateTransferCallToolDTO {
/**
* This determines if the tool is async.
*
* If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.
*
* If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.
*
* Defaults to synchronous (`false`).
* @example false
*/
async?: boolean;
/**
* These are the messages that will be spoken to the user as the tool is running.
*
* For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
*/
messages?: (
| ToolMessageStart
| ToolMessageComplete
| ToolMessageFailed
| ToolMessageDelayed
)[];
type: 'transferCall';
/** These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. */
destinations?: (
| AssistantTransferDestination
| NumberTransferDestination
| SipTransferDestination
)[];
/**
* This is the function definition of the tool.
*
* For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.
*
* An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument.
*/
function?: OpenAIFunction;
/**
* This is the server that will be hit when this tool is requested by the model.
*
* All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.
*
* This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
*/
server?: Server;
}
export interface OpenAIMessage {
content: string | null;
role: 'assistant' | 'function' | 'user' | 'system' | 'tool';
}
export interface KnowledgeBase {
provider: 'canonical';
/**
* @min 1
* @max 10
*/
topK?: number;
fileIds: string[];
}
export interface AnyscaleModel {
/** This is the starting state for the conversation. */
messages?: OpenAIMessage[];
/**
* These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`.
*
* Both `tools` and `toolIds` can be used together.
*/
tools?: (
| CreateDtmfToolDTO
| CreateEndCallToolDTO
| CreateVoicemailToolDTO
| CreateFunctionToolDTO
| CreateGhlToolDTO
| CreateMakeToolDTO
| CreateTransferCallToolDTO
)[];
/**
* These are the tools that the assistant can use during the call. To use transient tools, use `tools`.
*
* Both `tools` and `toolIds` can be used together.
*/
toolIds?: string[];
provider: 'anyscale';
/** This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b */
model: string;
/**
* This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.
* @min 0
* @max 2
*/
temperature?: number;
/** These are the options for the knowledge base. */
knowledgeBase?: KnowledgeBase;
/**
* This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.
* @min 50
* @max 1000
*/
maxTokens?: number;
/**
* This determines whether we detect user's emotion while they speak and send it as an additional info to model.
*
* Default `false` because the model is usually are good at understanding the user's emotion from text.
*/
emotionRecognitionEnabled?: boolean;
}
export interface AnthropicModel {
/** This is the starting state for the conversation. */
messages?: OpenAIMessage[];
/**
* These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`.
*
* Both `tools` and `toolIds` can be used together.
*/
tools?: (
| CreateDtmfToolDTO
| CreateEndCallToolDTO
| CreateVoicemailToolDTO
| CreateFunctionToolDTO
| CreateGhlToolDTO
| CreateMakeToolDTO
| CreateTransferCallToolDTO
)[];
/**
* These are the tools that the assistant can use during the call. To use transient tools, use `tools`.
*
* Both `tools` and `toolIds` can be used together.
*/
toolIds?: string[];
/** This is the Anthropic/Claude models that will be used. */
model:
| 'claude-3-opus-20240229'
| 'claude-3-sonnet-20240229'
| 'claude-3-haiku-20240307'
| 'claude-3-5-sonnet-20240620';
provider: 'anthropic';
/**
* This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.
* @min 0
* @max 2
*/
temperature?: number;
/** These are the options for the knowledge base. */
knowledgeBase?: KnowledgeBase;
/**
* This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.
* @min 50
* @max 1000
*/
maxTokens?: number;