telnyx 5.167.0 → 5.168.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/telnyx/client.rb +4 -0
  5. data/lib/telnyx/models/ai/assistant_a2_a_agent.rb +195 -0
  6. data/lib/telnyx/models/ai/assistant_create_params.rb +16 -1
  7. data/lib/telnyx/models/ai/assistant_update_params.rb +17 -1
  8. data/lib/telnyx/models/ai/assistants/update_assistant.rb +17 -1
  9. data/lib/telnyx/models/ai/chat_completion_request.rb +125 -48
  10. data/lib/telnyx/models/ai/inference_embedding.rb +16 -1
  11. data/lib/telnyx/models/ai/telephony_settings.rb +15 -1
  12. data/lib/telnyx/models/compute/func_retrieve_logs_params.rb +66 -0
  13. data/lib/telnyx/models/compute/func_retrieve_logs_response.rb +161 -0
  14. data/lib/telnyx/models/compute/func_retrieve_metric_aggregates_params.rb +69 -0
  15. data/lib/telnyx/models/compute/func_retrieve_metric_aggregates_response.rb +137 -0
  16. data/lib/telnyx/models/compute/func_retrieve_revisions_params.rb +34 -0
  17. data/lib/telnyx/models/compute/func_retrieve_revisions_response.rb +101 -0
  18. data/lib/telnyx/models/compute/func_retrieve_ship_inspection_params.rb +22 -0
  19. data/lib/telnyx/models/compute/func_retrieve_ship_inspection_response.rb +94 -0
  20. data/lib/telnyx/models/compute/functions_observability_pagination_meta.rb +35 -0
  21. data/lib/telnyx/models/compute/logs_meta.rb +23 -0
  22. data/lib/telnyx/models/credential_connection.rb +4 -1
  23. data/lib/telnyx/models/email_inboxes/email_message.rb +12 -1
  24. data/lib/telnyx/models/email_message_batch_params.rb +4 -1
  25. data/lib/telnyx/models/email_message_batch_response.rb +1 -0
  26. data/lib/telnyx/models/fqdn_connection.rb +5 -2
  27. data/lib/telnyx/models/fqdn_connections/fqdn_authentication.rb +9 -2
  28. data/lib/telnyx/models/messaging_inbound_message_payload.rb +210 -67
  29. data/lib/telnyx/models/messaging_messaging_profile.rb +11 -1
  30. data/lib/telnyx/models/messaging_profile_create_params.rb +11 -1
  31. data/lib/telnyx/models/messaging_profile_features.rb +26 -0
  32. data/lib/telnyx/models/messaging_profile_update_params.rb +11 -1
  33. data/lib/telnyx/models/uac_connection.rb +4 -1
  34. data/lib/telnyx/models/uac_external_settings.rb +6 -2
  35. data/lib/telnyx/models/unsafe_unwrap_webhook_event.rb +5 -1
  36. data/lib/telnyx/models/unwrap_webhook_event.rb +5 -1
  37. data/lib/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rb +104 -1
  38. data/lib/telnyx/models/whatsapp/phone_number_get_response.rb +103 -1
  39. data/lib/telnyx/models/whatsapp/phone_number_list_response.rb +103 -1
  40. data/lib/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rb +22 -0
  41. data/lib/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rb +207 -0
  42. data/lib/telnyx/models/whatsapp_account_update.rb +112 -0
  43. data/lib/telnyx/models/whatsapp_message_echo.rb +340 -0
  44. data/lib/telnyx/models/x402/credit_account/payment_list_params.rb +34 -0
  45. data/lib/telnyx/models/x402/credit_account/payment_retrieve_params.rb +24 -0
  46. data/lib/telnyx/models/x402/credit_account/payment_retrieve_response.rb +21 -0
  47. data/lib/telnyx/models/x402/credit_account/x402_transaction_record.rb +113 -0
  48. data/lib/telnyx/models.rb +8 -0
  49. data/lib/telnyx/resources/ai/assistants/versions.rb +3 -1
  50. data/lib/telnyx/resources/ai/assistants.rb +6 -2
  51. data/lib/telnyx/resources/ai/openai/chat.rb +2 -8
  52. data/lib/telnyx/resources/compute/funcs.rb +141 -0
  53. data/lib/telnyx/resources/compute.rb +18 -0
  54. data/lib/telnyx/resources/email_messages.rb +4 -2
  55. data/lib/telnyx/resources/messaging_profiles.rb +6 -2
  56. data/lib/telnyx/resources/webhooks.rb +2 -2
  57. data/lib/telnyx/resources/whatsapp/phone_numbers.rb +22 -0
  58. data/lib/telnyx/resources/x402/credit_account/payments.rb +71 -0
  59. data/lib/telnyx/resources/x402/credit_account.rb +8 -2
  60. data/lib/telnyx/version.rb +1 -1
  61. data/lib/telnyx.rb +23 -0
  62. data/rbi/telnyx/client.rbi +3 -0
  63. data/rbi/telnyx/models/ai/assistant_a2_a_agent.rbi +345 -0
  64. data/rbi/telnyx/models/ai/assistant_create_params.rbi +29 -0
  65. data/rbi/telnyx/models/ai/assistant_update_params.rbi +31 -0
  66. data/rbi/telnyx/models/ai/assistants/update_assistant.rbi +31 -0
  67. data/rbi/telnyx/models/ai/chat_completion_request.rbi +224 -92
  68. data/rbi/telnyx/models/ai/inference_embedding.rbi +29 -0
  69. data/rbi/telnyx/models/ai/telephony_settings.rbi +23 -0
  70. data/rbi/telnyx/models/compute/func_retrieve_logs_params.rbi +130 -0
  71. data/rbi/telnyx/models/compute/func_retrieve_logs_response.rbi +410 -0
  72. data/rbi/telnyx/models/compute/func_retrieve_metric_aggregates_params.rbi +102 -0
  73. data/rbi/telnyx/models/compute/func_retrieve_metric_aggregates_response.rbi +231 -0
  74. data/rbi/telnyx/models/compute/func_retrieve_revisions_params.rbi +59 -0
  75. data/rbi/telnyx/models/compute/func_retrieve_revisions_response.rbi +213 -0
  76. data/rbi/telnyx/models/compute/func_retrieve_ship_inspection_params.rbi +40 -0
  77. data/rbi/telnyx/models/compute/func_retrieve_ship_inspection_response.rbi +252 -0
  78. data/rbi/telnyx/models/compute/functions_observability_pagination_meta.rbi +70 -0
  79. data/rbi/telnyx/models/compute/logs_meta.rbi +38 -0
  80. data/rbi/telnyx/models/credential_connection.rbi +8 -2
  81. data/rbi/telnyx/models/email_inboxes/email_message.rbi +22 -3
  82. data/rbi/telnyx/models/email_message_batch_params.rbi +6 -0
  83. data/rbi/telnyx/models/email_message_batch_response.rbi +5 -0
  84. data/rbi/telnyx/models/fqdn_connection.rbi +8 -2
  85. data/rbi/telnyx/models/fqdn_connections/fqdn_authentication.rbi +8 -2
  86. data/rbi/telnyx/models/messaging_inbound_message_payload.rbi +450 -193
  87. data/rbi/telnyx/models/messaging_messaging_profile.rbi +19 -0
  88. data/rbi/telnyx/models/messaging_profile_create_params.rbi +19 -0
  89. data/rbi/telnyx/models/messaging_profile_features.rbi +43 -0
  90. data/rbi/telnyx/models/messaging_profile_update_params.rbi +19 -0
  91. data/rbi/telnyx/models/uac_connection.rbi +8 -2
  92. data/rbi/telnyx/models/uac_external_settings.rbi +10 -2
  93. data/rbi/telnyx/models/unsafe_unwrap_webhook_event.rbi +3 -1
  94. data/rbi/telnyx/models/unwrap_webhook_event.rbi +3 -1
  95. data/rbi/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rbi +213 -0
  96. data/rbi/telnyx/models/whatsapp/phone_number_get_response.rbi +213 -0
  97. data/rbi/telnyx/models/whatsapp/phone_number_list_response.rbi +213 -0
  98. data/rbi/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rbi +40 -0
  99. data/rbi/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rbi +401 -0
  100. data/rbi/telnyx/models/whatsapp_account_update.rbi +236 -0
  101. data/rbi/telnyx/models/whatsapp_message_echo.rbi +611 -0
  102. data/rbi/telnyx/models/x402/credit_account/payment_list_params.rbi +64 -0
  103. data/rbi/telnyx/models/x402/credit_account/payment_retrieve_params.rbi +42 -0
  104. data/rbi/telnyx/models/x402/credit_account/payment_retrieve_response.rbi +53 -0
  105. data/rbi/telnyx/models/x402/credit_account/x402_transaction_record.rbi +219 -0
  106. data/rbi/telnyx/models.rbi +8 -0
  107. data/rbi/telnyx/resources/ai/assistants/versions.rbi +12 -0
  108. data/rbi/telnyx/resources/ai/assistants.rbi +21 -0
  109. data/rbi/telnyx/resources/ai/openai/chat.rbi +9 -13
  110. data/rbi/telnyx/resources/compute/funcs.rbi +111 -0
  111. data/rbi/telnyx/resources/compute.rbi +15 -0
  112. data/rbi/telnyx/resources/email_messages.rbi +6 -2
  113. data/rbi/telnyx/resources/messaging_profiles.rbi +10 -0
  114. data/rbi/telnyx/resources/webhooks.rbi +6 -2
  115. data/rbi/telnyx/resources/whatsapp/phone_numbers.rbi +18 -0
  116. data/rbi/telnyx/resources/x402/credit_account/payments.rbi +60 -0
  117. data/rbi/telnyx/resources/x402/credit_account.rbi +5 -0
  118. data/sig/telnyx/client.rbs +2 -0
  119. data/sig/telnyx/models/ai/assistant_a2_a_agent.rbs +140 -0
  120. data/sig/telnyx/models/ai/assistant_create_params.rbs +9 -0
  121. data/sig/telnyx/models/ai/assistant_update_params.rbs +9 -0
  122. data/sig/telnyx/models/ai/assistants/update_assistant.rbs +9 -0
  123. data/sig/telnyx/models/ai/chat_completion_request.rbs +86 -44
  124. data/sig/telnyx/models/ai/inference_embedding.rbs +9 -0
  125. data/sig/telnyx/models/ai/telephony_settings.rbs +7 -0
  126. data/sig/telnyx/models/compute/func_retrieve_logs_params.rbs +69 -0
  127. data/sig/telnyx/models/compute/func_retrieve_logs_response.rbs +210 -0
  128. data/sig/telnyx/models/compute/func_retrieve_metric_aggregates_params.rbs +66 -0
  129. data/sig/telnyx/models/compute/func_retrieve_metric_aggregates_response.rbs +149 -0
  130. data/sig/telnyx/models/compute/func_retrieve_revisions_params.rbs +38 -0
  131. data/sig/telnyx/models/compute/func_retrieve_revisions_response.rbs +131 -0
  132. data/sig/telnyx/models/compute/func_retrieve_ship_inspection_params.rbs +22 -0
  133. data/sig/telnyx/models/compute/func_retrieve_ship_inspection_response.rbs +117 -0
  134. data/sig/telnyx/models/compute/functions_observability_pagination_meta.rbs +45 -0
  135. data/sig/telnyx/models/compute/logs_meta.rbs +21 -0
  136. data/sig/telnyx/models/email_inboxes/email_message.rbs +12 -3
  137. data/sig/telnyx/models/email_message_batch_response.rbs +2 -0
  138. data/sig/telnyx/models/messaging_inbound_message_payload.rbs +207 -95
  139. data/sig/telnyx/models/messaging_messaging_profile.rbs +5 -0
  140. data/sig/telnyx/models/messaging_profile_create_params.rbs +5 -0
  141. data/sig/telnyx/models/messaging_profile_features.rbs +15 -0
  142. data/sig/telnyx/models/messaging_profile_update_params.rbs +5 -0
  143. data/sig/telnyx/models/unsafe_unwrap_webhook_event.rbs +2 -0
  144. data/sig/telnyx/models/unwrap_webhook_event.rbs +2 -0
  145. data/sig/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rbs +90 -0
  146. data/sig/telnyx/models/whatsapp/phone_number_get_response.rbs +90 -0
  147. data/sig/telnyx/models/whatsapp/phone_number_list_response.rbs +90 -0
  148. data/sig/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rbs +25 -0
  149. data/sig/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rbs +201 -0
  150. data/sig/telnyx/models/whatsapp_account_update.rbs +107 -0
  151. data/sig/telnyx/models/whatsapp_message_echo.rbs +291 -0
  152. data/sig/telnyx/models/x402/credit_account/payment_list_params.rbs +36 -0
  153. data/sig/telnyx/models/x402/credit_account/payment_retrieve_params.rbs +27 -0
  154. data/sig/telnyx/models/x402/credit_account/payment_retrieve_response.rbs +26 -0
  155. data/sig/telnyx/models/x402/credit_account/x402_transaction_record.rbs +104 -0
  156. data/sig/telnyx/models.rbs +8 -0
  157. data/sig/telnyx/resources/ai/assistants/versions.rbs +1 -0
  158. data/sig/telnyx/resources/ai/assistants.rbs +2 -0
  159. data/sig/telnyx/resources/ai/openai/chat.rbs +1 -4
  160. data/sig/telnyx/resources/compute/funcs.rbs +41 -0
  161. data/sig/telnyx/resources/compute.rbs +9 -0
  162. data/sig/telnyx/resources/messaging_profiles.rbs +2 -0
  163. data/sig/telnyx/resources/webhooks.rbs +6 -2
  164. data/sig/telnyx/resources/whatsapp/phone_numbers.rbs +5 -0
  165. data/sig/telnyx/resources/x402/credit_account/payments.rbs +22 -0
  166. data/sig/telnyx/resources/x402/credit_account.rbs +2 -0
  167. metadata +71 -2
@@ -15,6 +15,25 @@ module Telnyx
15
15
  )
16
16
  end
17
17
 
18
+ # A2A agents this assistant can delegate to. Tools are not stored here: at the
19
+ # start of every conversation each agent's card is fetched and one tool is derived
20
+ # per skill the card advertises, named `a2a_<name>_<skill_id>`. The following
21
+ # limits are not enforced when the assistant is saved, and anything past them is
22
+ # dropped when the conversation starts: 64 agents per assistant, 64 skills per
23
+ # card, 128 derived tools per assistant, and a 6 second budget for all card
24
+ # fetches combined. An agent whose card cannot be fetched costs the assistant that
25
+ # capability for the conversation; it does not fail the call. Omit this field to
26
+ # leave the assistant's agents unchanged; send an empty array to remove them all.
27
+ sig { returns(T.nilable(T::Array[Telnyx::AI::AssistantA2AAgent])) }
28
+ attr_reader :a2a_agents
29
+
30
+ sig do
31
+ params(
32
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent::OrHash]
33
+ ).void
34
+ end
35
+ attr_writer :a2a_agents
36
+
18
37
  # Conversation flow as supplied by API clients (create / update).
19
38
  #
20
39
  # A directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation enforces
@@ -354,6 +373,7 @@ module Telnyx
354
373
 
355
374
  sig do
356
375
  params(
376
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent::OrHash],
357
377
  conversation_flow: Telnyx::AI::ConversationFlowReq::OrHash,
358
378
  description: String,
359
379
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -405,6 +425,16 @@ module Telnyx
405
425
  ).returns(T.attached_class)
406
426
  end
407
427
  def self.new(
428
+ # A2A agents this assistant can delegate to. Tools are not stored here: at the
429
+ # start of every conversation each agent's card is fetched and one tool is derived
430
+ # per skill the card advertises, named `a2a_<name>_<skill_id>`. The following
431
+ # limits are not enforced when the assistant is saved, and anything past them is
432
+ # dropped when the conversation starts: 64 agents per assistant, 64 skills per
433
+ # card, 128 derived tools per assistant, and a 6 second budget for all card
434
+ # fetches combined. An agent whose card cannot be fetched costs the assistant that
435
+ # capability for the conversation; it does not fail the call. Omit this field to
436
+ # leave the assistant's agents unchanged; send an empty array to remove them all.
437
+ a2a_agents: nil,
408
438
  # Conversation flow as supplied by API clients (create / update).
409
439
  #
410
440
  # A directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation enforces
@@ -504,6 +534,7 @@ module Telnyx
504
534
  sig do
505
535
  override.returns(
506
536
  {
537
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent],
507
538
  conversation_flow: Telnyx::AI::ConversationFlowReq,
508
539
  description: String,
509
540
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -56,28 +56,6 @@ module Telnyx
56
56
  sig { params(frequency_penalty: Float).void }
57
57
  attr_writer :frequency_penalty
58
58
 
59
- # If specified, the output will be exactly one of the choices.
60
- sig { returns(T.nilable(T::Array[String])) }
61
- attr_reader :guided_choice
62
-
63
- sig { params(guided_choice: T::Array[String]).void }
64
- attr_writer :guided_choice
65
-
66
- # Must be a valid JSON schema. If specified, the output will follow the JSON
67
- # schema.
68
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
69
- attr_reader :guided_json
70
-
71
- sig { params(guided_json: T::Hash[Symbol, T.anything]).void }
72
- attr_writer :guided_json
73
-
74
- # If specified, the output will follow the regex pattern.
75
- sig { returns(T.nilable(String)) }
76
- attr_reader :guided_regex
77
-
78
- sig { params(guided_regex: String).void }
79
- attr_writer :guided_regex
80
-
81
59
  # This is used with `use_beam_search` to prefer shorter or longer completions.
82
60
  sig { returns(T.nilable(Float)) }
83
61
  attr_reader :length_penalty
@@ -187,17 +165,31 @@ module Telnyx
187
165
  end
188
166
  attr_writer :region
189
167
 
190
- # Use this is you want to guarantee a JSON output without defining a schema. For
191
- # control over the schema, use `guided_json`.
168
+ # Controls the format of the model output. `json_object` guarantees valid JSON
169
+ # output without defining a schema; `json_schema` constrains the output to the
170
+ # JSON schema you supply via the `json_schema` property and is the supported way
171
+ # to get guaranteed structured output on Telnyx-hosted models.
192
172
  sig do
193
- returns(T.nilable(Telnyx::AI::ChatCompletionRequest::ResponseFormat))
173
+ returns(
174
+ T.nilable(
175
+ T.any(
176
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
177
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject,
178
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam
179
+ )
180
+ )
181
+ )
194
182
  end
195
183
  attr_reader :response_format
196
184
 
197
185
  sig do
198
186
  params(
199
187
  response_format:
200
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::OrHash
188
+ T.any(
189
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText::OrHash,
190
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject::OrHash,
191
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::OrHash
192
+ )
201
193
  ).void
202
194
  end
203
195
  attr_writer :response_format
@@ -329,9 +321,6 @@ module Telnyx
329
321
  early_stopping: T::Boolean,
330
322
  enable_thinking: T::Boolean,
331
323
  frequency_penalty: Float,
332
- guided_choice: T::Array[String],
333
- guided_json: T::Hash[Symbol, T.anything],
334
- guided_regex: String,
335
324
  length_penalty: Float,
336
325
  logprobs: T::Boolean,
337
326
  max_tokens: Integer,
@@ -344,7 +333,11 @@ module Telnyx
344
333
  Telnyx::AI::ChatCompletionRequest::ReasoningEffort::OrSymbol,
345
334
  region: Telnyx::AI::ChatCompletionRequest::Region::OrSymbol,
346
335
  response_format:
347
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::OrHash,
336
+ T.any(
337
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText::OrHash,
338
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject::OrHash,
339
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::OrHash
340
+ ),
348
341
  seed: Integer,
349
342
  service_tier: String,
350
343
  stop: Telnyx::AI::ChatCompletionRequest::Stop::Variants,
@@ -385,13 +378,6 @@ module Telnyx
385
378
  enable_thinking: nil,
386
379
  # Higher values will penalize the model from repeating the same output tokens.
387
380
  frequency_penalty: nil,
388
- # If specified, the output will be exactly one of the choices.
389
- guided_choice: nil,
390
- # Must be a valid JSON schema. If specified, the output will follow the JSON
391
- # schema.
392
- guided_json: nil,
393
- # If specified, the output will follow the regex pattern.
394
- guided_regex: nil,
395
381
  # This is used with `use_beam_search` to prefer shorter or longer completions.
396
382
  length_penalty: nil,
397
383
  # Whether to return log probabilities of the output tokens or not. If true,
@@ -428,8 +414,10 @@ module Telnyx
428
414
  # provider never passes through Telnyx model routing, so a region cannot be
429
415
  # enforced for it. Omit for today's latency-based routing.
430
416
  region: nil,
431
- # Use this is you want to guarantee a JSON output without defining a schema. For
432
- # control over the schema, use `guided_json`.
417
+ # Controls the format of the model output. `json_object` guarantees valid JSON
418
+ # output without defining a schema; `json_schema` constrains the output to the
419
+ # JSON schema you supply via the `json_schema` property and is the supported way
420
+ # to get guaranteed structured output on Telnyx-hosted models.
433
421
  response_format: nil,
434
422
  # If specified, the system will make a best effort to sample deterministically,
435
423
  # such that repeated requests with the same `seed` and parameters should return
@@ -478,9 +466,6 @@ module Telnyx
478
466
  early_stopping: T::Boolean,
479
467
  enable_thinking: T::Boolean,
480
468
  frequency_penalty: Float,
481
- guided_choice: T::Array[String],
482
- guided_json: T::Hash[Symbol, T.anything],
483
- guided_regex: String,
484
469
  length_penalty: Float,
485
470
  logprobs: T::Boolean,
486
471
  max_tokens: Integer,
@@ -493,7 +478,11 @@ module Telnyx
493
478
  Telnyx::AI::ChatCompletionRequest::ReasoningEffort::OrSymbol,
494
479
  region: Telnyx::AI::ChatCompletionRequest::Region::OrSymbol,
495
480
  response_format:
496
- Telnyx::AI::ChatCompletionRequest::ResponseFormat,
481
+ T.any(
482
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
483
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject,
484
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam
485
+ ),
497
486
  seed: Integer,
498
487
  service_tier: String,
499
488
  stop: Telnyx::AI::ChatCompletionRequest::Stop::Variants,
@@ -848,76 +837,219 @@ module Telnyx
848
837
  end
849
838
  end
850
839
 
851
- class ResponseFormat < Telnyx::Internal::Type::BaseModel
852
- OrHash =
840
+ # Controls the format of the model output. `json_object` guarantees valid JSON
841
+ # output without defining a schema; `json_schema` constrains the output to the
842
+ # JSON schema you supply via the `json_schema` property and is the supported way
843
+ # to get guaranteed structured output on Telnyx-hosted models.
844
+ module ResponseFormat
845
+ extend Telnyx::Internal::Type::Union
846
+
847
+ Variants =
853
848
  T.type_alias do
854
849
  T.any(
855
- Telnyx::AI::ChatCompletionRequest::ResponseFormat,
856
- Telnyx::Internal::AnyHash
850
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
851
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject,
852
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam
857
853
  )
858
854
  end
859
855
 
860
- sig do
861
- returns(
862
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
863
- )
864
- end
865
- attr_accessor :type
856
+ class ResponseFormatText < Telnyx::Internal::Type::BaseModel
857
+ OrHash =
858
+ T.type_alias do
859
+ T.any(
860
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
861
+ Telnyx::Internal::AnyHash
862
+ )
863
+ end
866
864
 
867
- # Use this is you want to guarantee a JSON output without defining a schema. For
868
- # control over the schema, use `guided_json`.
869
- sig do
870
- params(
871
- type:
872
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
873
- ).returns(T.attached_class)
874
- end
875
- def self.new(type:)
876
- end
865
+ sig { returns(Symbol) }
866
+ attr_accessor :type
877
867
 
878
- sig do
879
- override.returns(
880
- {
881
- type:
882
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
883
- }
884
- )
885
- end
886
- def to_hash
868
+ # Plain text output.
869
+ sig { params(type: Symbol).returns(T.attached_class) }
870
+ def self.new(type: :text)
871
+ end
872
+
873
+ sig { override.returns({ type: Symbol }) }
874
+ def to_hash
875
+ end
887
876
  end
888
877
 
889
- module Type
890
- extend Telnyx::Internal::Type::Enum
878
+ class ResponseFormatJsonObject < Telnyx::Internal::Type::BaseModel
879
+ OrHash =
880
+ T.type_alias do
881
+ T.any(
882
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject,
883
+ Telnyx::Internal::AnyHash
884
+ )
885
+ end
891
886
 
892
- TaggedSymbol =
887
+ sig { returns(Symbol) }
888
+ attr_accessor :type
889
+
890
+ # JSON mode: the model output is valid JSON, without a schema.
891
+ sig { params(type: Symbol).returns(T.attached_class) }
892
+ def self.new(type: :json_object)
893
+ end
894
+
895
+ sig { override.returns({ type: Symbol }) }
896
+ def to_hash
897
+ end
898
+ end
899
+
900
+ class ResponseFormatJsonSchemaParam < Telnyx::Internal::Type::BaseModel
901
+ OrHash =
893
902
  T.type_alias do
894
- T.all(
895
- Symbol,
896
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type
903
+ T.any(
904
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam,
905
+ Telnyx::Internal::AnyHash
897
906
  )
898
907
  end
899
- OrSymbol = T.type_alias { T.any(Symbol, String) }
900
908
 
901
- TEXT =
902
- T.let(
903
- :text,
904
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
905
- )
906
- JSON_OBJECT =
907
- T.let(
908
- :json_object,
909
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
909
+ # The JSON schema configuration, required when `type` is `json_schema`. Matches
910
+ # the
911
+ # [OpenAI structured outputs](https://platform.openai.com/docs/guides/structured-outputs)
912
+ # `json_schema` response format.
913
+ sig do
914
+ returns(
915
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema
910
916
  )
917
+ end
918
+ attr_reader :json_schema
919
+
920
+ sig do
921
+ params(
922
+ json_schema:
923
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema::OrHash
924
+ ).void
925
+ end
926
+ attr_writer :json_schema
927
+
928
+ sig { returns(Symbol) }
929
+ attr_accessor :type
930
+
931
+ # Structured output: the model output is constrained to the JSON schema supplied
932
+ # in `json_schema`.
933
+ sig do
934
+ params(
935
+ json_schema:
936
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema::OrHash,
937
+ type: Symbol
938
+ ).returns(T.attached_class)
939
+ end
940
+ def self.new(
941
+ # The JSON schema configuration, required when `type` is `json_schema`. Matches
942
+ # the
943
+ # [OpenAI structured outputs](https://platform.openai.com/docs/guides/structured-outputs)
944
+ # `json_schema` response format.
945
+ json_schema:,
946
+ type: :json_schema
947
+ )
948
+ end
911
949
 
912
950
  sig do
913
951
  override.returns(
914
- T::Array[
915
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
916
- ]
952
+ {
953
+ json_schema:
954
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema,
955
+ type: Symbol
956
+ }
917
957
  )
918
958
  end
919
- def self.values
959
+ def to_hash
920
960
  end
961
+
962
+ class JsonSchema < Telnyx::Internal::Type::BaseModel
963
+ OrHash =
964
+ T.type_alias do
965
+ T.any(
966
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema,
967
+ Telnyx::Internal::AnyHash
968
+ )
969
+ end
970
+
971
+ # The name of the response format. Used for clarity only.
972
+ sig { returns(String) }
973
+ attr_accessor :name
974
+
975
+ # A description of what the response format is for, typically used to guide the
976
+ # model.
977
+ sig { returns(T.nilable(String)) }
978
+ attr_reader :description
979
+
980
+ sig { params(description: String).void }
981
+ attr_writer :description
982
+
983
+ # The JSON schema the model output must conform to. A valid
984
+ # [JSON Schema](https://json-schema.org) object, e.g. a Pydantic
985
+ # `model_json_schema()` export.
986
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
987
+ attr_reader :schema
988
+
989
+ sig { params(schema: T::Hash[Symbol, T.anything]).void }
990
+ attr_writer :schema
991
+
992
+ # Enables strict schema adherence when supported by the model. If the generated
993
+ # output does not match the provided schema, the request fails instead of
994
+ # returning non-conformant output.
995
+ sig { returns(T.nilable(T::Boolean)) }
996
+ attr_reader :strict
997
+
998
+ sig { params(strict: T::Boolean).void }
999
+ attr_writer :strict
1000
+
1001
+ # The JSON schema configuration, required when `type` is `json_schema`. Matches
1002
+ # the
1003
+ # [OpenAI structured outputs](https://platform.openai.com/docs/guides/structured-outputs)
1004
+ # `json_schema` response format.
1005
+ sig do
1006
+ params(
1007
+ name: String,
1008
+ description: String,
1009
+ schema: T::Hash[Symbol, T.anything],
1010
+ strict: T::Boolean
1011
+ ).returns(T.attached_class)
1012
+ end
1013
+ def self.new(
1014
+ # The name of the response format. Used for clarity only.
1015
+ name:,
1016
+ # A description of what the response format is for, typically used to guide the
1017
+ # model.
1018
+ description: nil,
1019
+ # The JSON schema the model output must conform to. A valid
1020
+ # [JSON Schema](https://json-schema.org) object, e.g. a Pydantic
1021
+ # `model_json_schema()` export.
1022
+ schema: nil,
1023
+ # Enables strict schema adherence when supported by the model. If the generated
1024
+ # output does not match the provided schema, the request fails instead of
1025
+ # returning non-conformant output.
1026
+ strict: nil
1027
+ )
1028
+ end
1029
+
1030
+ sig do
1031
+ override.returns(
1032
+ {
1033
+ name: String,
1034
+ description: String,
1035
+ schema: T::Hash[Symbol, T.anything],
1036
+ strict: T::Boolean
1037
+ }
1038
+ )
1039
+ end
1040
+ def to_hash
1041
+ end
1042
+ end
1043
+ end
1044
+
1045
+ sig do
1046
+ override.returns(
1047
+ T::Array[
1048
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::Variants
1049
+ ]
1050
+ )
1051
+ end
1052
+ def self.variants
921
1053
  end
922
1054
  end
923
1055
 
@@ -31,6 +31,24 @@ module Telnyx
31
31
  sig { returns(String) }
32
32
  attr_accessor :name
33
33
 
34
+ # A2A agents this assistant can delegate to. Tools are not stored here: at the
35
+ # start of every conversation each agent's card is fetched and one tool is derived
36
+ # per skill the card advertises, named `a2a_<name>_<skill_id>`. The following
37
+ # limits are not enforced when the assistant is saved, and anything past them is
38
+ # dropped when the conversation starts: 64 agents per assistant, 64 skills per
39
+ # card, 128 derived tools per assistant, and a 6 second budget for all card
40
+ # fetches combined. An agent whose card cannot be fetched costs the assistant that
41
+ # capability for the conversation; it does not fail the call.
42
+ sig { returns(T.nilable(T::Array[Telnyx::AI::AssistantA2AAgent])) }
43
+ attr_reader :a2a_agents
44
+
45
+ sig do
46
+ params(
47
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent::OrHash]
48
+ ).void
49
+ end
50
+ attr_writer :a2a_agents
51
+
34
52
  # Conversation flow as returned by the API.
35
53
  sig { returns(T.nilable(Telnyx::AI::ConversationFlow)) }
36
54
  attr_reader :conversation_flow
@@ -332,6 +350,7 @@ module Telnyx
332
350
  instructions: String,
333
351
  model: String,
334
352
  name: String,
353
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent::OrHash],
335
354
  conversation_flow: Telnyx::AI::ConversationFlow::OrHash,
336
355
  description: String,
337
356
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -395,6 +414,15 @@ module Telnyx
395
414
  # provided, Telnyx applies the default model.
396
415
  model:,
397
416
  name:,
417
+ # A2A agents this assistant can delegate to. Tools are not stored here: at the
418
+ # start of every conversation each agent's card is fetched and one tool is derived
419
+ # per skill the card advertises, named `a2a_<name>_<skill_id>`. The following
420
+ # limits are not enforced when the assistant is saved, and anything past them is
421
+ # dropped when the conversation starts: 64 agents per assistant, 64 skills per
422
+ # card, 128 derived tools per assistant, and a 6 second budget for all card
423
+ # fetches combined. An agent whose card cannot be fetched costs the assistant that
424
+ # capability for the conversation; it does not fail the call.
425
+ a2a_agents: nil,
398
426
  # Conversation flow as returned by the API.
399
427
  conversation_flow: nil,
400
428
  description: nil,
@@ -490,6 +518,7 @@ module Telnyx
490
518
  instructions: String,
491
519
  model: String,
492
520
  name: String,
521
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent],
493
522
  conversation_flow: Telnyx::AI::ConversationFlow,
494
523
  description: String,
495
524
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -26,6 +26,19 @@ module Telnyx
26
26
  sig { params(disable_dtmf: T::Boolean).void }
27
27
  attr_writer :disable_dtmf
28
28
 
29
+ # Destination number or SIP URI to transfer the caller to when the AI conversation
30
+ # ends abnormally, for example because of an assistant-side error, so the caller
31
+ # is not left in dead air. This only fires for abnormal ends: it does not fire
32
+ # when the conversation ends on purpose (the caller hung up, the assistant
33
+ # completed normally, the caller hung up after a relay handoff, or voicemail was
34
+ # detected), and it does not fire when the assistant already transferred or
35
+ # bridged the call.
36
+ sig { returns(T.nilable(String)) }
37
+ attr_reader :fallback_destination
38
+
39
+ sig { params(fallback_destination: String).void }
40
+ attr_writer :fallback_destination
41
+
29
42
  # The noise suppression engine to use. Use 'disabled' to turn off noise
30
43
  # suppression.
31
44
  sig do
@@ -149,6 +162,7 @@ module Telnyx
149
162
  params(
150
163
  default_texml_app_id: String,
151
164
  disable_dtmf: T::Boolean,
165
+ fallback_destination: String,
152
166
  noise_suppression:
153
167
  Telnyx::AI::TelephonySettings::NoiseSuppression::OrSymbol,
154
168
  noise_suppression_config:
@@ -172,6 +186,14 @@ module Telnyx
172
186
  # configured anywhere on the assistant — on the main tool array or on any workflow
173
187
  # node — enforced at write time.
174
188
  disable_dtmf: nil,
189
+ # Destination number or SIP URI to transfer the caller to when the AI conversation
190
+ # ends abnormally, for example because of an assistant-side error, so the caller
191
+ # is not left in dead air. This only fires for abnormal ends: it does not fire
192
+ # when the conversation ends on purpose (the caller hung up, the assistant
193
+ # completed normally, the caller hung up after a relay handoff, or voicemail was
194
+ # detected), and it does not fire when the assistant already transferred or
195
+ # bridged the call.
196
+ fallback_destination: nil,
175
197
  # The noise suppression engine to use. Use 'disabled' to turn off noise
176
198
  # suppression.
177
199
  noise_suppression: nil,
@@ -222,6 +244,7 @@ module Telnyx
222
244
  {
223
245
  default_texml_app_id: String,
224
246
  disable_dtmf: T::Boolean,
247
+ fallback_destination: String,
225
248
  noise_suppression:
226
249
  Telnyx::AI::TelephonySettings::NoiseSuppression::OrSymbol,
227
250
  noise_suppression_config: