-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaiassistant.go
More file actions
1691 lines (1629 loc) · 72.3 KB
/
Copy pathaiassistant.go
File metadata and controls
1691 lines (1629 loc) · 72.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package cmd
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-cli/internal/apiquery"
"github.com/team-telnyx/telnyx-cli/internal/requestflag"
"github.com/team-telnyx/telnyx-go/v4"
"github.com/team-telnyx/telnyx-go/v4/option"
"github.com/tidwall/gjson"
"github.com/urfave/cli/v3"
)
var aiAssistantsCreate = requestflag.WithInnerFlags(cli.Command{
Name: "create",
Usage: "Create a new AI Assistant.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "instructions",
Usage: "System instructions for the assistant. These may be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables)",
Required: true,
BodyPath: "instructions",
},
&requestflag.Flag[string]{
Name: "name",
Required: true,
BodyPath: "name",
},
&requestflag.Flag[map[string]any]{
Name: "conversation-flow",
Usage: "Conversation flow as supplied by API clients (create / update).\n\nA directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation\nenforces unique node/edge IDs, that `start_node_id` references a real\nnode, and that every edge's endpoints reference real nodes.",
BodyPath: "conversation_flow",
},
&requestflag.Flag[string]{
Name: "description",
BodyPath: "description",
},
&requestflag.Flag[map[string]any]{
Name: "dynamic-variables",
Usage: "Map of dynamic variables and their default values",
BodyPath: "dynamic_variables",
},
&requestflag.Flag[int64]{
Name: "dynamic-variables-webhook-timeout-ms",
Usage: "Timeout in milliseconds for the dynamic variables webhook. Must be between 1 and 10000 ms. If the webhook does not respond within this timeout, the call proceeds with default values. See the [dynamic variables guide](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables).",
Default: 1500,
BodyPath: "dynamic_variables_webhook_timeout_ms",
},
&requestflag.Flag[string]{
Name: "dynamic-variables-webhook-url",
Usage: "If `dynamic_variables_webhook_url` is set, Telnyx sends a POST request to this URL at the start of the conversation to resolve dynamic variables. **Gotcha:** the webhook response must wrap variables under a top-level `dynamic_variables` object, e.g. `{\"dynamic_variables\": {\"customer_name\": \"Jane\"}}`. Returning a flat object will be ignored and variables will fall back to their defaults. See the [dynamic variables guide](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables) for the full request/response format and timeout behavior.",
BodyPath: "dynamic_variables_webhook_url",
},
&requestflag.Flag[[]string]{
Name: "enabled-feature",
BodyPath: "enabled_features",
},
&requestflag.Flag[map[string]any]{
Name: "external-llm",
BodyPath: "external_llm",
},
&requestflag.Flag[map[string]any]{
Name: "fallback-config",
BodyPath: "fallback_config",
},
&requestflag.Flag[string]{
Name: "greeting",
Usage: "Text that the assistant will use to start the conversation. This may be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables). Use an empty string to have the assistant wait for the user to speak first. Use the special value `<assistant-speaks-first-with-model-generated-message>` to have the assistant generate the greeting based on the system instructions.",
BodyPath: "greeting",
},
&requestflag.Flag[map[string]any]{
Name: "insight-settings",
BodyPath: "insight_settings",
},
&requestflag.Flag[[]map[string]any]{
Name: "integration",
Usage: "Connected integrations attached to the assistant. The catalog of available integrations is at `/ai/integrations`; the user's connected integrations are at `/ai/integrations/connections`. Each item references a catalog integration by `integration_id`.",
Default: []map[string]any{},
BodyPath: "integrations",
},
&requestflag.Flag[map[string]any]{
Name: "interruption-settings",
Usage: "Settings for interruptions and how the assistant decides the user has finished speaking. These timings are most relevant when using non turn-taking transcription models. For turn-taking models like `deepgram/flux`, end-of-turn behavior is controlled by the transcription end-of-turn settings under `transcription.settings` (`eot_threshold`, `eot_timeout_ms`, `eager_eot_threshold`).",
BodyPath: "interruption_settings",
},
&requestflag.Flag[string]{
Name: "llm-api-key-ref",
Usage: "This is only needed when using third-party inference providers selected by `model`. The `identifier` for an integration secret [/v2/integration_secrets](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) that refers to your LLM provider's API key. For bring-your-own endpoint authentication, use `external_llm.llm_api_key_ref` instead. Warning: Free plans are unlikely to work with this integration.",
BodyPath: "llm_api_key_ref",
},
&requestflag.Flag[[]map[string]any]{
Name: "mcp-server",
Usage: "MCP servers attached to the assistant. Create MCP servers with `/ai/mcp_servers`, then reference them by `id` here.",
Default: []map[string]any{},
BodyPath: "mcp_servers",
},
&requestflag.Flag[map[string]any]{
Name: "messaging-settings",
BodyPath: "messaging_settings",
},
&requestflag.Flag[string]{
Name: "model",
Usage: "ID of the model to use when `external_llm` is not set. You can use the [Get models API](https://developers.telnyx.com/api-reference/openai-chat/get-available-models-openai-compatible) to see available models. If `external_llm` is provided, the assistant uses `external_llm` instead of this field. If neither `model` nor `external_llm` is provided, Telnyx applies the default model.",
BodyPath: "model",
},
&requestflag.Flag[map[string]any]{
Name: "observability-settings",
BodyPath: "observability_settings",
},
&requestflag.Flag[map[string]any]{
Name: "post-conversation-settings",
Usage: "Configuration for post-conversation processing. When enabled, the assistant receives one additional LLM turn after the conversation ends, allowing it to execute tool calls such as logging to a CRM or sending a summary. The assistant can execute multiple parallel or sequential tools during this phase. Telephony-control tools (e.g. hangup, transfer) are unavailable post-conversation. Beta feature.",
BodyPath: "post_conversation_settings",
},
&requestflag.Flag[map[string]any]{
Name: "privacy-settings",
BodyPath: "privacy_settings",
},
&requestflag.Flag[[]string]{
Name: "tag",
Usage: "Tags associated with the assistant. Tags can also be managed with the assistant tag endpoints.",
Default: []string{},
BodyPath: "tags",
},
&requestflag.Flag[map[string]any]{
Name: "telephony-settings",
BodyPath: "telephony_settings",
},
&requestflag.Flag[[]string]{
Name: "tool-id",
Usage: "IDs of shared tools to attach to the assistant. New integrations should prefer `tool_ids` over inline `tools`.",
BodyPath: "tool_ids",
},
&requestflag.Flag[[]map[string]any]{
Name: "tool",
Usage: "Deprecated for new integrations. Inline tool definitions available to the assistant. Prefer `tool_ids` to attach shared tools created with the AI Tools endpoints.",
BodyPath: "tools",
},
&requestflag.Flag[map[string]any]{
Name: "transcription",
BodyPath: "transcription",
},
&requestflag.Flag[map[string]any]{
Name: "voice-settings",
BodyPath: "voice_settings",
},
&requestflag.Flag[map[string]any]{
Name: "widget-settings",
Usage: "Configuration settings for the assistant's web widget.",
BodyPath: "widget_settings",
},
},
Action: handleAIAssistantsCreate,
HideHelpCommand: true,
}, map[string][]requestflag.HasOuterFlag{
"conversation-flow": {
&requestflag.InnerFlag[[]map[string]any]{
Name: "conversation-flow.nodes",
Usage: "All nodes in the flow. Must contain `start_node_id`. Each node is a prompt node (`type: prompt`) or a tool node (`type: tool`).",
InnerField: "nodes",
},
&requestflag.InnerFlag[string]{
Name: "conversation-flow.start-node-id",
Usage: "ID of the node where the conversation begins.",
InnerField: "start_node_id",
},
&requestflag.InnerFlag[[]map[string]any]{
Name: "conversation-flow.edges",
Usage: "Directed transitions between nodes. May be empty for a single-node flow.",
InnerField: "edges",
},
},
"external-llm": {
&requestflag.InnerFlag[string]{
Name: "external-llm.base-url",
Usage: "Base URL for the external LLM endpoint.",
InnerField: "base_url",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.model",
Usage: "Model identifier to use with the external LLM endpoint.",
InnerField: "model",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.authentication-method",
Usage: "Authentication method used when connecting to the external LLM endpoint.",
InnerField: "authentication_method",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.certificate-ref",
Usage: "Integration secret identifier for the client certificate used with certificate authentication.",
InnerField: "certificate_ref",
},
&requestflag.InnerFlag[bool]{
Name: "external-llm.forward-metadata",
Usage: "When `true`, Telnyx forwards the assistant's dynamic variables to the external LLM endpoint as a top-level `extra_metadata` object on the chat completion request body. Defaults to `false`. Example payload sent to the external endpoint: `{\"extra_metadata\": {\"customer_name\": \"Jane\", \"account_id\": \"acct_789\", \"telnyx_agent_target\": \"+13125550100\", \"telnyx_end_user_target\": \"+13125550123\"}}`. Distinct from OpenAI's native `metadata` field, which has its own size and type limits.",
InnerField: "forward_metadata",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.llm-api-key-ref",
Usage: "Integration secret identifier for the external LLM API key.",
InnerField: "llm_api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.token-retrieval-url",
Usage: "URL used to retrieve an access token when certificate authentication is enabled.",
InnerField: "token_retrieval_url",
},
},
"fallback-config": {
&requestflag.InnerFlag[map[string]any]{
Name: "fallback-config.external-llm",
InnerField: "external_llm",
},
&requestflag.InnerFlag[string]{
Name: "fallback-config.llm-api-key-ref",
Usage: "Integration secret identifier for the fallback model API key.",
InnerField: "llm_api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "fallback-config.model",
Usage: "Fallback Telnyx-hosted model to use when the primary LLM provider is unavailable.",
InnerField: "model",
},
},
"insight-settings": {
&requestflag.InnerFlag[string]{
Name: "insight-settings.insight-group-id",
Usage: "Reference to an Insight Group. Insights in this group will be run automatically for all the assistant's conversations.",
InnerField: "insight_group_id",
},
},
"integration": {
&requestflag.InnerFlag[string]{
Name: "integration.integration-id",
Usage: "Catalog integration ID to attach. This is the `id` from the integrations catalog at `/ai/integrations` (the same value also appears as `integration_id` on entries returned by `/ai/integrations/connections`). It is **not** the connection-level `id` from `/ai/integrations/connections`.",
InnerField: "integration_id",
},
&requestflag.InnerFlag[[]string]{
Name: "integration.allowed-list",
Usage: "Optional per-assistant allowlist of integration tool names. When omitted or empty, all tools allowed by the connected integration are available to the assistant.",
InnerField: "allowed_list",
},
},
"interruption-settings": {
&requestflag.InnerFlag[bool]{
Name: "interruption-settings.disable-greeting-interruption",
Usage: "When true, disables user interruptions while the assistant greeting is playing.",
InnerField: "disable_greeting_interruption",
},
&requestflag.InnerFlag[bool]{
Name: "interruption-settings.enable",
Usage: "Whether users can interrupt the assistant while it is speaking.",
InnerField: "enable",
},
&requestflag.InnerFlag[map[string]any]{
Name: "interruption-settings.start-speaking-plan",
Usage: "Controls when the assistant starts speaking after the user stops. These thresholds primarily apply to non turn-taking transcription models. For turn-taking models like `deepgram/flux`, end-of-turn detection is driven by the transcription end-of-turn settings under `transcription.settings` instead.",
InnerField: "start_speaking_plan",
},
},
"mcp-server": {
&requestflag.InnerFlag[string]{
Name: "mcp-server.id",
Usage: "ID of the MCP server to attach. This must be the `id` of an MCP server returned by the `/ai/mcp_servers` endpoints.",
InnerField: "id",
},
&requestflag.InnerFlag[[]string]{
Name: "mcp-server.allowed-tools",
Usage: "Optional per-assistant allowlist of MCP tool names. When omitted, the assistant uses the MCP server's configured `allowed_tools`.",
InnerField: "allowed_tools",
},
},
"messaging-settings": {
&requestflag.InnerFlag[int64]{
Name: "messaging-settings.conversation-inactivity-minutes",
Usage: "If more than this many minutes have passed since the last message, the assistant will start a new conversation instead of continuing the existing one.",
InnerField: "conversation_inactivity_minutes",
},
&requestflag.InnerFlag[string]{
Name: "messaging-settings.default-messaging-profile-id",
Usage: "Default Messaging Profile used for messaging exchanges with your assistant. This will be created automatically on assistant creation.",
InnerField: "default_messaging_profile_id",
},
&requestflag.InnerFlag[string]{
Name: "messaging-settings.delivery-status-webhook-url",
Usage: "The URL where webhooks related to delivery statused for assistant messages will be sent.",
InnerField: "delivery_status_webhook_url",
},
},
"observability-settings": {
&requestflag.InnerFlag[string]{
Name: "observability-settings.host",
InnerField: "host",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-label",
InnerField: "prompt_label",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-name",
InnerField: "prompt_name",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-sync",
Usage: "Whether to auto-publish the assistant's instructions as a Langfuse prompt.\n\nWhen ENABLED + prompt_name set, every assistant create/update pushes\n`instructions` to Langfuse via create_prompt and stores the returned\nversion in prompt_version.",
InnerField: "prompt_sync",
},
&requestflag.InnerFlag[int64]{
Name: "observability-settings.prompt-version",
InnerField: "prompt_version",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.public-key-ref",
InnerField: "public_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.secret-key-ref",
InnerField: "secret_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.status",
Usage: `Allowed values: "enabled", "disabled".`,
InnerField: "status",
},
},
"post-conversation-settings": {
&requestflag.InnerFlag[bool]{
Name: "post-conversation-settings.enabled",
Usage: "Whether post-conversation processing is enabled. When true, the assistant will be invoked after the conversation ends to perform any final tool calls. Defaults to false.",
InnerField: "enabled",
},
},
"privacy-settings": {
&requestflag.InnerFlag[bool]{
Name: "privacy-settings.data-retention",
Usage: "If true, conversation history and insights will be stored. If false, they will not be stored. This in‑tool toggle governs solely the retention of conversation history and insights via the AI assistant. It has no effect on any separate recording, transcription, or storage configuration that you have set at the account, number, or application level. All such external settings remain in force regardless of your selection here.",
InnerField: "data_retention",
},
},
"telephony-settings": {
&requestflag.InnerFlag[string]{
Name: "telephony-settings.default-texml-app-id",
Usage: "Default Texml App used for voice calls with your assistant. This will be created automatically on assistant creation.",
InnerField: "default_texml_app_id",
},
&requestflag.InnerFlag[string]{
Name: "telephony-settings.noise-suppression",
Usage: "The noise suppression engine to use. Use 'disabled' to turn off noise suppression.",
InnerField: "noise_suppression",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.noise-suppression-config",
Usage: "Configuration for noise suppression. Only applicable when noise_suppression is 'deepfilternet'.",
InnerField: "noise_suppression_config",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.recording-settings",
Usage: "Configuration for call recording format and channel settings.",
InnerField: "recording_settings",
},
&requestflag.InnerFlag[bool]{
Name: "telephony-settings.supports-unauthenticated-web-calls",
Usage: "When enabled, allows users to interact with your AI assistant directly from your website without requiring authentication. This is required for FE widgets that work with assistants that have telephony enabled.",
InnerField: "supports_unauthenticated_web_calls",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.time-limit-secs",
Usage: "Maximum duration in seconds for the AI assistant to participate on the call. When this limit is reached the assistant will be stopped. This limit does not apply to portions of a call without an active assistant (for instance, a call transferred to a human representative).",
InnerField: "time_limit_secs",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.user-idle-reply-secs",
Usage: "Duration in seconds of end user silence before the assistant checks in on the user. When this limit is reached the assistant will prompt the user to respond. This is distinct from user_idle_timeout_secs which stops the assistant entirely.",
InnerField: "user_idle_reply_secs",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.user-idle-timeout-secs",
Usage: "Maximum duration in seconds of end user silence on the call. When this limit is reached the assistant will be stopped. This limit does not apply to portions of a call without an active assistant (for instance, a call transferred to a human representative).",
InnerField: "user_idle_timeout_secs",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.voicemail-detection",
Usage: "Configuration for voicemail detection (AMD - Answering Machine Detection) on outgoing calls. These settings only apply if AMD is enabled on the Dial command. See [TeXML Dial documentation](https://developers.telnyx.com/api-reference/texml-rest-commands/initiate-an-outbound-call) for enabling AMD. Recommended settings: MachineDetection=Enable, AsyncAmd=true, DetectionMode=Premium.",
InnerField: "voicemail_detection",
},
},
"transcription": {
&requestflag.InnerFlag[string]{
Name: "transcription.api-key-ref",
Usage: "Integration secret identifier for the transcription provider API key. Currently used for Azure transcription regions that require a customer-provided API key.",
InnerField: "api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "transcription.language",
Usage: "The language of the audio to be transcribed. If not set, or if set to `auto`, supported models will automatically detect the language. For `deepgram/flux`, supported values are: `auto` (Telnyx language detection controls the language hint), `multi` (no language hint), and language-specific hints `en`, `es`, `fr`, `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`. For `soniox/stt-rt-v4`, `auto` omits the language hint and lets Soniox auto-detect; ISO 639-1 codes (e.g. `en`, `es`) bias detection toward that language.",
InnerField: "language",
},
&requestflag.InnerFlag[string]{
Name: "transcription.model",
Usage: "The speech to text model to be used by the voice assistant. All Deepgram models are run on-premise.\n\n- `deepgram/flux` is optimized for turn-taking with multilingual language hints.\n- `deepgram/nova-3` is multilingual with automatic language detection.\n- `deepgram/nova-2` is Deepgram's previous-generation multilingual model.\n- `azure/fast` is a multilingual Azure transcription model.\n- `assemblyai/universal-streaming` is a multilingual streaming model with configurable turn detection.\n- `xai/grok-stt` is a multilingual Grok STT model.\n- `soniox/stt-rt-v4` is a multilingual streaming model with automatic language detection and configurable endpointing.\n- `parakeet/tdt-0.6b-v3` is a multilingual transcription model with automatic language detection.",
InnerField: "model",
},
&requestflag.InnerFlag[string]{
Name: "transcription.region",
Usage: "Region on third party cloud providers (currently Azure) if using one of their models. Some regions require `api_key_ref`.",
InnerField: "region",
},
&requestflag.InnerFlag[map[string]any]{
Name: "transcription.settings",
InnerField: "settings",
},
},
"voice-settings": {
&requestflag.InnerFlag[string]{
Name: "voice-settings.voice",
Usage: "The voice to be used by the voice assistant. Check the full list of [available voices](https://developers.telnyx.com/docs/tts-stt/tts-available-voices) via our voices API.\nTo use ElevenLabs, you must reference your ElevenLabs API key as an integration secret under the `api_key_ref` field. See [integration secrets documentation](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) for details. For Telnyx voices, use `Telnyx.<model_id>.<voice_id>` (e.g. Telnyx.KokoroTTS.af_heart).\nThe voice portion of the identifier supports [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables) using mustache syntax (e.g. `Telnyx.Ultra.{{voice_id}}`). The variable is resolved at call time from your dynamic variables webhook, allowing you to select the voice dynamically per call.",
InnerField: "voice",
},
&requestflag.InnerFlag[string]{
Name: "voice-settings.api-key-ref",
Usage: "The `identifier` for an integration secret [/v2/integration_secrets](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) that refers to your ElevenLabs API key. Warning: Free plans are unlikely to work with this integration.",
InnerField: "api_key_ref",
},
&requestflag.InnerFlag[map[string]any]{
Name: "voice-settings.background-audio",
Usage: "Optional background audio to play on the call. Use a predefined media bed, or supply a looped MP3 URL. If a media URL is chosen in the portal, customers can preview it before saving.",
InnerField: "background_audio",
},
&requestflag.InnerFlag[bool]{
Name: "voice-settings.expressive-mode",
Usage: "Enables emotionally expressive speech using SSML emotion tags. When enabled, the assistant uses audio tags like angry, excited, content, and sad to add emotional nuance. Only supported for Telnyx Ultra voices.",
InnerField: "expressive_mode",
},
&requestflag.InnerFlag[*string]{
Name: "voice-settings.language-boost",
Usage: "Enhances recognition for specific languages and dialects during MiniMax TTS synthesis. Default is null (no boost). Set to 'auto' for automatic language detection. Only applicable when using MiniMax voices.",
InnerField: "language_boost",
},
&requestflag.InnerFlag[float64]{
Name: "voice-settings.similarity-boost",
Usage: "Determines how closely the AI should adhere to the original voice when attempting to replicate it. Only applicable when using ElevenLabs.",
InnerField: "similarity_boost",
},
&requestflag.InnerFlag[float64]{
Name: "voice-settings.speed",
Usage: "Adjusts speech velocity. 1.0 is default speed; values less than 1.0 slow speech; values greater than 1.0 accelerate it. Only applicable when using ElevenLabs.",
InnerField: "speed",
},
&requestflag.InnerFlag[float64]{
Name: "voice-settings.style",
Usage: "Determines the style exaggeration of the voice. Amplifies speaker style but consumes additional resources when set above 0. Only applicable when using ElevenLabs.",
InnerField: "style",
},
&requestflag.InnerFlag[float64]{
Name: "voice-settings.temperature",
Usage: "Determines how stable the voice is and the randomness between each generation. Lower values create a broader emotional range; higher values produce more consistent, monotonous output. Only applicable when using ElevenLabs.",
InnerField: "temperature",
},
&requestflag.InnerFlag[bool]{
Name: "voice-settings.use-speaker-boost",
Usage: "Amplifies similarity to the original speaker voice. Increases computational load and latency slightly. Only applicable when using ElevenLabs.",
InnerField: "use_speaker_boost",
},
&requestflag.InnerFlag[float64]{
Name: "voice-settings.voice-speed",
Usage: "The speed of the voice in the range [0.25, 2.0]. 1.0 is deafult speed. Larger numbers make the voice faster, smaller numbers make it slower. This is only applicable for Telnyx Natural voices.",
InnerField: "voice_speed",
},
},
"widget-settings": {
&requestflag.InnerFlag[string]{
Name: "widget-settings.agent-thinking-text",
Usage: "Text displayed while the agent is processing.",
InnerField: "agent_thinking_text",
},
&requestflag.InnerFlag[map[string]any]{
Name: "widget-settings.audio-visualizer-config",
InnerField: "audio_visualizer_config",
},
&requestflag.InnerFlag[string]{
Name: "widget-settings.default-state",
Usage: "The default state of the widget.",
InnerField: "default_state",
},
&requestflag.InnerFlag[*string]{
Name: "widget-settings.give-feedback-url",
Usage: "URL for users to give feedback.",
InnerField: "give_feedback_url",
},
&requestflag.InnerFlag[*string]{
Name: "widget-settings.logo-icon-url",
Usage: "URL to a custom logo icon for the widget.",
InnerField: "logo_icon_url",
},
&requestflag.InnerFlag[string]{
Name: "widget-settings.position",
Usage: "The positioning style for the widget.",
InnerField: "position",
},
&requestflag.InnerFlag[*string]{
Name: "widget-settings.report-issue-url",
Usage: "URL for users to report issues.",
InnerField: "report_issue_url",
},
&requestflag.InnerFlag[string]{
Name: "widget-settings.speak-to-interrupt-text",
Usage: "Text prompting users to speak to interrupt.",
InnerField: "speak_to_interrupt_text",
},
&requestflag.InnerFlag[string]{
Name: "widget-settings.start-call-text",
Usage: "Custom text displayed on the start call button.",
InnerField: "start_call_text",
},
&requestflag.InnerFlag[string]{
Name: "widget-settings.theme",
Usage: "The visual theme for the widget.",
InnerField: "theme",
},
&requestflag.InnerFlag[*string]{
Name: "widget-settings.view-history-url",
Usage: "URL to view conversation history.",
InnerField: "view_history_url",
},
},
})
var aiAssistantsRetrieve = cli.Command{
Name: "retrieve",
Usage: "Retrieve an AI Assistant configuration by `assistant_id`.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "assistant-id",
Required: true,
PathParam: "assistant_id",
},
&requestflag.Flag[string]{
Name: "call-control-id",
Usage: "Filter results by call control id.",
QueryPath: "call_control_id",
},
&requestflag.Flag[bool]{
Name: "fetch-dynamic-variables-from-webhook",
Usage: "Whether to fetch dynamic variables from the configured webhook.",
Default: false,
QueryPath: "fetch_dynamic_variables_from_webhook",
},
&requestflag.Flag[string]{
Name: "from",
Usage: "Start of the filter range.",
QueryPath: "from",
},
&requestflag.Flag[string]{
Name: "to",
Usage: "End of the filter range.",
QueryPath: "to",
},
},
Action: handleAIAssistantsRetrieve,
HideHelpCommand: true,
}
var aiAssistantsUpdate = requestflag.WithInnerFlags(cli.Command{
Name: "update",
Usage: "Update an AI Assistant's attributes.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "assistant-id",
Required: true,
PathParam: "assistant_id",
},
&requestflag.Flag[map[string]any]{
Name: "conversation-flow",
Usage: "Conversation flow as supplied by API clients (create / update).\n\nA directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation\nenforces unique node/edge IDs, that `start_node_id` references a real\nnode, and that every edge's endpoints reference real nodes.",
BodyPath: "conversation_flow",
},
&requestflag.Flag[string]{
Name: "description",
BodyPath: "description",
},
&requestflag.Flag[map[string]any]{
Name: "dynamic-variables",
Usage: "Map of dynamic variables and their default values",
BodyPath: "dynamic_variables",
},
&requestflag.Flag[int64]{
Name: "dynamic-variables-webhook-timeout-ms",
Usage: "Timeout in milliseconds for the dynamic variables webhook. Must be between 1 and 10000 ms. If the webhook does not respond within this timeout, the call proceeds with default values. See the [dynamic variables guide](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables).",
Default: 1500,
BodyPath: "dynamic_variables_webhook_timeout_ms",
},
&requestflag.Flag[string]{
Name: "dynamic-variables-webhook-url",
Usage: "If `dynamic_variables_webhook_url` is set, Telnyx sends a POST request to this URL at the start of the conversation to resolve dynamic variables. **Gotcha:** the webhook response must wrap variables under a top-level `dynamic_variables` object, e.g. `{\"dynamic_variables\": {\"customer_name\": \"Jane\"}}`. Returning a flat object will be ignored and variables will fall back to their defaults. See the [dynamic variables guide](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables) for the full request/response format and timeout behavior.",
BodyPath: "dynamic_variables_webhook_url",
},
&requestflag.Flag[[]string]{
Name: "enabled-feature",
BodyPath: "enabled_features",
},
&requestflag.Flag[map[string]any]{
Name: "external-llm",
BodyPath: "external_llm",
},
&requestflag.Flag[map[string]any]{
Name: "fallback-config",
BodyPath: "fallback_config",
},
&requestflag.Flag[string]{
Name: "greeting",
Usage: "Text that the assistant will use to start the conversation. This may be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables). Use an empty string to have the assistant wait for the user to speak first. Use the special value `<assistant-speaks-first-with-model-generated-message>` to have the assistant generate the greeting based on the system instructions.",
BodyPath: "greeting",
},
&requestflag.Flag[map[string]any]{
Name: "insight-settings",
BodyPath: "insight_settings",
},
&requestflag.Flag[string]{
Name: "instructions",
Usage: "System instructions for the assistant. These may be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables)",
BodyPath: "instructions",
},
&requestflag.Flag[[]map[string]any]{
Name: "integration",
Usage: "Connected integrations attached to the assistant. The catalog of available integrations is at `/ai/integrations`; the user's connected integrations are at `/ai/integrations/connections`. Each item references a catalog integration by `integration_id`.",
Default: []map[string]any{},
BodyPath: "integrations",
},
&requestflag.Flag[map[string]any]{
Name: "interruption-settings",
Usage: "Settings for interruptions and how the assistant decides the user has finished speaking. These timings are most relevant when using non turn-taking transcription models. For turn-taking models like `deepgram/flux`, end-of-turn behavior is controlled by the transcription end-of-turn settings under `transcription.settings` (`eot_threshold`, `eot_timeout_ms`, `eager_eot_threshold`).",
BodyPath: "interruption_settings",
},
&requestflag.Flag[string]{
Name: "llm-api-key-ref",
Usage: "This is only needed when using third-party inference providers selected by `model`. The `identifier` for an integration secret [/v2/integration_secrets](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) that refers to your LLM provider's API key. For bring-your-own endpoint authentication, use `external_llm.llm_api_key_ref` instead. Warning: Free plans are unlikely to work with this integration.",
BodyPath: "llm_api_key_ref",
},
&requestflag.Flag[[]map[string]any]{
Name: "mcp-server",
Usage: "MCP servers attached to the assistant. Create MCP servers with `/ai/mcp_servers`, then reference them by `id` here.",
Default: []map[string]any{},
BodyPath: "mcp_servers",
},
&requestflag.Flag[map[string]any]{
Name: "messaging-settings",
BodyPath: "messaging_settings",
},
&requestflag.Flag[string]{
Name: "model",
Usage: "ID of the model to use when `external_llm` is not set. You can use the [Get models API](https://developers.telnyx.com/api-reference/openai-chat/get-available-models-openai-compatible) to see available models. If `external_llm` is provided, the assistant uses `external_llm` instead of this field. If neither `model` nor `external_llm` is provided, Telnyx applies the default model.",
BodyPath: "model",
},
&requestflag.Flag[string]{
Name: "name",
BodyPath: "name",
},
&requestflag.Flag[map[string]any]{
Name: "observability-settings",
BodyPath: "observability_settings",
},
&requestflag.Flag[map[string]any]{
Name: "post-conversation-settings",
Usage: "Configuration for post-conversation processing. When enabled, the assistant receives one additional LLM turn after the conversation ends, allowing it to execute tool calls such as logging to a CRM or sending a summary. The assistant can execute multiple parallel or sequential tools during this phase. Telephony-control tools (e.g. hangup, transfer) are unavailable post-conversation. Beta feature.",
BodyPath: "post_conversation_settings",
},
&requestflag.Flag[map[string]any]{
Name: "privacy-settings",
BodyPath: "privacy_settings",
},
&requestflag.Flag[bool]{
Name: "promote-to-main",
Usage: "Indicates whether the assistant should be promoted to the main version. Defaults to true.",
Default: true,
BodyPath: "promote_to_main",
},
&requestflag.Flag[[]string]{
Name: "tag",
Usage: "Tags associated with the assistant. Tags can also be managed with the assistant tag endpoints.",
Default: []string{},
BodyPath: "tags",
},
&requestflag.Flag[map[string]any]{
Name: "telephony-settings",
BodyPath: "telephony_settings",
},
&requestflag.Flag[[]string]{
Name: "tool-id",
Usage: "IDs of shared tools to attach to the assistant. New integrations should prefer `tool_ids` over inline `tools`.",
BodyPath: "tool_ids",
},
&requestflag.Flag[[]map[string]any]{
Name: "tool",
Usage: "Deprecated for new integrations. Inline tool definitions available to the assistant. Prefer `tool_ids` to attach shared tools created with the AI Tools endpoints.",
BodyPath: "tools",
},
&requestflag.Flag[map[string]any]{
Name: "transcription",
BodyPath: "transcription",
},
&requestflag.Flag[string]{
Name: "version-name",
Usage: "Human-readable name for the assistant version.",
Default: "New assistant",
BodyPath: "version_name",
},
&requestflag.Flag[map[string]any]{
Name: "voice-settings",
BodyPath: "voice_settings",
},
&requestflag.Flag[map[string]any]{
Name: "widget-settings",
Usage: "Configuration settings for the assistant's web widget.",
BodyPath: "widget_settings",
},
},
Action: handleAIAssistantsUpdate,
HideHelpCommand: true,
}, map[string][]requestflag.HasOuterFlag{
"conversation-flow": {
&requestflag.InnerFlag[[]map[string]any]{
Name: "conversation-flow.nodes",
Usage: "All nodes in the flow. Must contain `start_node_id`. Each node is a prompt node (`type: prompt`) or a tool node (`type: tool`).",
InnerField: "nodes",
},
&requestflag.InnerFlag[string]{
Name: "conversation-flow.start-node-id",
Usage: "ID of the node where the conversation begins.",
InnerField: "start_node_id",
},
&requestflag.InnerFlag[[]map[string]any]{
Name: "conversation-flow.edges",
Usage: "Directed transitions between nodes. May be empty for a single-node flow.",
InnerField: "edges",
},
},
"external-llm": {
&requestflag.InnerFlag[string]{
Name: "external-llm.base-url",
Usage: "Base URL for the external LLM endpoint.",
InnerField: "base_url",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.model",
Usage: "Model identifier to use with the external LLM endpoint.",
InnerField: "model",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.authentication-method",
Usage: "Authentication method used when connecting to the external LLM endpoint.",
InnerField: "authentication_method",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.certificate-ref",
Usage: "Integration secret identifier for the client certificate used with certificate authentication.",
InnerField: "certificate_ref",
},
&requestflag.InnerFlag[bool]{
Name: "external-llm.forward-metadata",
Usage: "When `true`, Telnyx forwards the assistant's dynamic variables to the external LLM endpoint as a top-level `extra_metadata` object on the chat completion request body. Defaults to `false`. Example payload sent to the external endpoint: `{\"extra_metadata\": {\"customer_name\": \"Jane\", \"account_id\": \"acct_789\", \"telnyx_agent_target\": \"+13125550100\", \"telnyx_end_user_target\": \"+13125550123\"}}`. Distinct from OpenAI's native `metadata` field, which has its own size and type limits.",
InnerField: "forward_metadata",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.llm-api-key-ref",
Usage: "Integration secret identifier for the external LLM API key.",
InnerField: "llm_api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "external-llm.token-retrieval-url",
Usage: "URL used to retrieve an access token when certificate authentication is enabled.",
InnerField: "token_retrieval_url",
},
},
"fallback-config": {
&requestflag.InnerFlag[map[string]any]{
Name: "fallback-config.external-llm",
InnerField: "external_llm",
},
&requestflag.InnerFlag[string]{
Name: "fallback-config.llm-api-key-ref",
Usage: "Integration secret identifier for the fallback model API key.",
InnerField: "llm_api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "fallback-config.model",
Usage: "Fallback Telnyx-hosted model to use when the primary LLM provider is unavailable.",
InnerField: "model",
},
},
"insight-settings": {
&requestflag.InnerFlag[string]{
Name: "insight-settings.insight-group-id",
Usage: "Reference to an Insight Group. Insights in this group will be run automatically for all the assistant's conversations.",
InnerField: "insight_group_id",
},
},
"integration": {
&requestflag.InnerFlag[string]{
Name: "integration.integration-id",
Usage: "Catalog integration ID to attach. This is the `id` from the integrations catalog at `/ai/integrations` (the same value also appears as `integration_id` on entries returned by `/ai/integrations/connections`). It is **not** the connection-level `id` from `/ai/integrations/connections`.",
InnerField: "integration_id",
},
&requestflag.InnerFlag[[]string]{
Name: "integration.allowed-list",
Usage: "Optional per-assistant allowlist of integration tool names. When omitted or empty, all tools allowed by the connected integration are available to the assistant.",
InnerField: "allowed_list",
},
},
"interruption-settings": {
&requestflag.InnerFlag[bool]{
Name: "interruption-settings.disable-greeting-interruption",
Usage: "When true, disables user interruptions while the assistant greeting is playing.",
InnerField: "disable_greeting_interruption",
},
&requestflag.InnerFlag[bool]{
Name: "interruption-settings.enable",
Usage: "Whether users can interrupt the assistant while it is speaking.",
InnerField: "enable",
},
&requestflag.InnerFlag[map[string]any]{
Name: "interruption-settings.start-speaking-plan",
Usage: "Controls when the assistant starts speaking after the user stops. These thresholds primarily apply to non turn-taking transcription models. For turn-taking models like `deepgram/flux`, end-of-turn detection is driven by the transcription end-of-turn settings under `transcription.settings` instead.",
InnerField: "start_speaking_plan",
},
},
"mcp-server": {
&requestflag.InnerFlag[string]{
Name: "mcp-server.id",
Usage: "ID of the MCP server to attach. This must be the `id` of an MCP server returned by the `/ai/mcp_servers` endpoints.",
InnerField: "id",
},
&requestflag.InnerFlag[[]string]{
Name: "mcp-server.allowed-tools",
Usage: "Optional per-assistant allowlist of MCP tool names. When omitted, the assistant uses the MCP server's configured `allowed_tools`.",
InnerField: "allowed_tools",
},
},
"messaging-settings": {
&requestflag.InnerFlag[int64]{
Name: "messaging-settings.conversation-inactivity-minutes",
Usage: "If more than this many minutes have passed since the last message, the assistant will start a new conversation instead of continuing the existing one.",
InnerField: "conversation_inactivity_minutes",
},
&requestflag.InnerFlag[string]{
Name: "messaging-settings.default-messaging-profile-id",
Usage: "Default Messaging Profile used for messaging exchanges with your assistant. This will be created automatically on assistant creation.",
InnerField: "default_messaging_profile_id",
},
&requestflag.InnerFlag[string]{
Name: "messaging-settings.delivery-status-webhook-url",
Usage: "The URL where webhooks related to delivery statused for assistant messages will be sent.",
InnerField: "delivery_status_webhook_url",
},
},
"observability-settings": {
&requestflag.InnerFlag[string]{
Name: "observability-settings.host",
InnerField: "host",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-label",
InnerField: "prompt_label",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-name",
InnerField: "prompt_name",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.prompt-sync",
Usage: "Whether to auto-publish the assistant's instructions as a Langfuse prompt.\n\nWhen ENABLED + prompt_name set, every assistant create/update pushes\n`instructions` to Langfuse via create_prompt and stores the returned\nversion in prompt_version.",
InnerField: "prompt_sync",
},
&requestflag.InnerFlag[int64]{
Name: "observability-settings.prompt-version",
InnerField: "prompt_version",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.public-key-ref",
InnerField: "public_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.secret-key-ref",
InnerField: "secret_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "observability-settings.status",
Usage: `Allowed values: "enabled", "disabled".`,
InnerField: "status",
},
},
"post-conversation-settings": {
&requestflag.InnerFlag[bool]{
Name: "post-conversation-settings.enabled",
Usage: "Whether post-conversation processing is enabled. When true, the assistant will be invoked after the conversation ends to perform any final tool calls. Defaults to false.",
InnerField: "enabled",
},
},
"privacy-settings": {
&requestflag.InnerFlag[bool]{
Name: "privacy-settings.data-retention",
Usage: "If true, conversation history and insights will be stored. If false, they will not be stored. This in‑tool toggle governs solely the retention of conversation history and insights via the AI assistant. It has no effect on any separate recording, transcription, or storage configuration that you have set at the account, number, or application level. All such external settings remain in force regardless of your selection here.",
InnerField: "data_retention",
},
},
"telephony-settings": {
&requestflag.InnerFlag[string]{
Name: "telephony-settings.default-texml-app-id",
Usage: "Default Texml App used for voice calls with your assistant. This will be created automatically on assistant creation.",
InnerField: "default_texml_app_id",
},
&requestflag.InnerFlag[string]{
Name: "telephony-settings.noise-suppression",
Usage: "The noise suppression engine to use. Use 'disabled' to turn off noise suppression.",
InnerField: "noise_suppression",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.noise-suppression-config",
Usage: "Configuration for noise suppression. Only applicable when noise_suppression is 'deepfilternet'.",
InnerField: "noise_suppression_config",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.recording-settings",
Usage: "Configuration for call recording format and channel settings.",
InnerField: "recording_settings",
},
&requestflag.InnerFlag[bool]{
Name: "telephony-settings.supports-unauthenticated-web-calls",
Usage: "When enabled, allows users to interact with your AI assistant directly from your website without requiring authentication. This is required for FE widgets that work with assistants that have telephony enabled.",
InnerField: "supports_unauthenticated_web_calls",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.time-limit-secs",
Usage: "Maximum duration in seconds for the AI assistant to participate on the call. When this limit is reached the assistant will be stopped. This limit does not apply to portions of a call without an active assistant (for instance, a call transferred to a human representative).",
InnerField: "time_limit_secs",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.user-idle-reply-secs",
Usage: "Duration in seconds of end user silence before the assistant checks in on the user. When this limit is reached the assistant will prompt the user to respond. This is distinct from user_idle_timeout_secs which stops the assistant entirely.",
InnerField: "user_idle_reply_secs",
},
&requestflag.InnerFlag[int64]{
Name: "telephony-settings.user-idle-timeout-secs",
Usage: "Maximum duration in seconds of end user silence on the call. When this limit is reached the assistant will be stopped. This limit does not apply to portions of a call without an active assistant (for instance, a call transferred to a human representative).",
InnerField: "user_idle_timeout_secs",
},
&requestflag.InnerFlag[map[string]any]{
Name: "telephony-settings.voicemail-detection",
Usage: "Configuration for voicemail detection (AMD - Answering Machine Detection) on outgoing calls. These settings only apply if AMD is enabled on the Dial command. See [TeXML Dial documentation](https://developers.telnyx.com/api-reference/texml-rest-commands/initiate-an-outbound-call) for enabling AMD. Recommended settings: MachineDetection=Enable, AsyncAmd=true, DetectionMode=Premium.",
InnerField: "voicemail_detection",
},
},
"transcription": {
&requestflag.InnerFlag[string]{
Name: "transcription.api-key-ref",
Usage: "Integration secret identifier for the transcription provider API key. Currently used for Azure transcription regions that require a customer-provided API key.",
InnerField: "api_key_ref",
},
&requestflag.InnerFlag[string]{
Name: "transcription.language",
Usage: "The language of the audio to be transcribed. If not set, or if set to `auto`, supported models will automatically detect the language. For `deepgram/flux`, supported values are: `auto` (Telnyx language detection controls the language hint), `multi` (no language hint), and language-specific hints `en`, `es`, `fr`, `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`. For `soniox/stt-rt-v4`, `auto` omits the language hint and lets Soniox auto-detect; ISO 639-1 codes (e.g. `en`, `es`) bias detection toward that language.",
InnerField: "language",
},
&requestflag.InnerFlag[string]{
Name: "transcription.model",
Usage: "The speech to text model to be used by the voice assistant. All Deepgram models are run on-premise.\n\n- `deepgram/flux` is optimized for turn-taking with multilingual language hints.\n- `deepgram/nova-3` is multilingual with automatic language detection.\n- `deepgram/nova-2` is Deepgram's previous-generation multilingual model.\n- `azure/fast` is a multilingual Azure transcription model.\n- `assemblyai/universal-streaming` is a multilingual streaming model with configurable turn detection.\n- `xai/grok-stt` is a multilingual Grok STT model.\n- `soniox/stt-rt-v4` is a multilingual streaming model with automatic language detection and configurable endpointing.\n- `parakeet/tdt-0.6b-v3` is a multilingual transcription model with automatic language detection.",
InnerField: "model",
},
&requestflag.InnerFlag[string]{
Name: "transcription.region",
Usage: "Region on third party cloud providers (currently Azure) if using one of their models. Some regions require `api_key_ref`.",
InnerField: "region",
},
&requestflag.InnerFlag[map[string]any]{
Name: "transcription.settings",
InnerField: "settings",
},
},
"voice-settings": {
&requestflag.InnerFlag[string]{
Name: "voice-settings.voice",
Usage: "The voice to be used by the voice assistant. Check the full list of [available voices](https://developers.telnyx.com/docs/tts-stt/tts-available-voices) via our voices API.\nTo use ElevenLabs, you must reference your ElevenLabs API key as an integration secret under the `api_key_ref` field. See [integration secrets documentation](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) for details. For Telnyx voices, use `Telnyx.<model_id>.<voice_id>` (e.g. Telnyx.KokoroTTS.af_heart).\nThe voice portion of the identifier supports [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables) using mustache syntax (e.g. `Telnyx.Ultra.{{voice_id}}`). The variable is resolved at call time from your dynamic variables webhook, allowing you to select the voice dynamically per call.",
InnerField: "voice",
},
&requestflag.InnerFlag[string]{
Name: "voice-settings.api-key-ref",
Usage: "The `identifier` for an integration secret [/v2/integration_secrets](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret) that refers to your ElevenLabs API key. Warning: Free plans are unlikely to work with this integration.",
InnerField: "api_key_ref",
},
&requestflag.InnerFlag[map[string]any]{
Name: "voice-settings.background-audio",
Usage: "Optional background audio to play on the call. Use a predefined media bed, or supply a looped MP3 URL. If a media URL is chosen in the portal, customers can preview it before saving.",
InnerField: "background_audio",
},