telnyx 5.166.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/lib/telnyx/client.rb +4 -0
  5. data/lib/telnyx/internal/default_flat_pagination.rb +7 -3
  6. data/lib/telnyx/internal/default_flat_pagination_for_inexplicit_number_orders.rb +7 -3
  7. data/lib/telnyx/internal/default_flat_pagination_top_level_array.rb +10 -8
  8. data/lib/telnyx/internal/default_pagination_for_log_messages.rb +7 -3
  9. data/lib/telnyx/internal/default_pagination_for_messaging_tollfree.rb +12 -3
  10. data/lib/telnyx/internal/default_pagination_for_queues.rb +12 -3
  11. data/lib/telnyx/internal/per_page_pagination.rb +8 -1
  12. data/lib/telnyx/internal/per_page_pagination_v2.rb +8 -1
  13. data/lib/telnyx/internal/type/converter.rb +2 -0
  14. data/lib/telnyx/models/ai/anthropic/v1_messages_params.rb +57 -1
  15. data/lib/telnyx/models/ai/assistant_a2_a_agent.rb +195 -0
  16. data/lib/telnyx/models/ai/assistant_create_params.rb +16 -1
  17. data/lib/telnyx/models/ai/assistant_update_params.rb +17 -1
  18. data/lib/telnyx/models/ai/assistants/update_assistant.rb +17 -1
  19. data/lib/telnyx/models/ai/chat_completion_request.rb +185 -48
  20. data/lib/telnyx/models/ai/inference_embedding.rb +16 -1
  21. data/lib/telnyx/models/ai/openai_create_response_params.rb +57 -1
  22. data/lib/telnyx/models/ai/telephony_settings.rb +15 -1
  23. data/lib/telnyx/models/compute/func_retrieve_logs_params.rb +66 -0
  24. data/lib/telnyx/models/compute/func_retrieve_logs_response.rb +161 -0
  25. data/lib/telnyx/models/compute/func_retrieve_metric_aggregates_params.rb +69 -0
  26. data/lib/telnyx/models/compute/func_retrieve_metric_aggregates_response.rb +137 -0
  27. data/lib/telnyx/models/compute/func_retrieve_revisions_params.rb +34 -0
  28. data/lib/telnyx/models/compute/func_retrieve_revisions_response.rb +101 -0
  29. data/lib/telnyx/models/compute/func_retrieve_ship_inspection_params.rb +22 -0
  30. data/lib/telnyx/models/compute/func_retrieve_ship_inspection_response.rb +94 -0
  31. data/lib/telnyx/models/compute/functions_observability_pagination_meta.rb +35 -0
  32. data/lib/telnyx/models/compute/logs_meta.rb +23 -0
  33. data/lib/telnyx/models/credential_connection.rb +4 -1
  34. data/lib/telnyx/models/email_inboxes/email_message.rb +12 -1
  35. data/lib/telnyx/models/email_message_batch_params.rb +4 -1
  36. data/lib/telnyx/models/email_message_batch_response.rb +1 -0
  37. data/lib/telnyx/models/fqdn_connection.rb +5 -2
  38. data/lib/telnyx/models/fqdn_connections/fqdn_authentication.rb +9 -2
  39. data/lib/telnyx/models/messaging_inbound_message_payload.rb +210 -67
  40. data/lib/telnyx/models/messaging_messaging_profile.rb +284 -0
  41. data/lib/telnyx/models/messaging_profile.rb +0 -1
  42. data/lib/telnyx/models/messaging_profile_create_params.rb +11 -1
  43. data/lib/telnyx/models/messaging_profile_create_response.rb +3 -3
  44. data/lib/telnyx/models/messaging_profile_delete_response.rb +3 -3
  45. data/lib/telnyx/models/messaging_profile_features.rb +26 -0
  46. data/lib/telnyx/models/messaging_profile_retrieve_response.rb +3 -3
  47. data/lib/telnyx/models/messaging_profile_update_params.rb +32 -1
  48. data/lib/telnyx/models/messaging_profile_update_response.rb +3 -3
  49. data/lib/telnyx/models/messaging_profiles/action_regenerate_secret_response.rb +3 -3
  50. data/lib/telnyx/models/uac_connection.rb +4 -1
  51. data/lib/telnyx/models/uac_external_settings.rb +6 -2
  52. data/lib/telnyx/models/unsafe_unwrap_webhook_event.rb +5 -1
  53. data/lib/telnyx/models/unwrap_webhook_event.rb +5 -1
  54. data/lib/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rb +104 -1
  55. data/lib/telnyx/models/whatsapp/phone_number_get_response.rb +103 -1
  56. data/lib/telnyx/models/whatsapp/phone_number_list_response.rb +103 -1
  57. data/lib/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rb +22 -0
  58. data/lib/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rb +207 -0
  59. data/lib/telnyx/models/whatsapp_account_update.rb +112 -0
  60. data/lib/telnyx/models/whatsapp_message_echo.rb +340 -0
  61. data/lib/telnyx/models/x402/credit_account/payment_list_params.rb +34 -0
  62. data/lib/telnyx/models/x402/credit_account/payment_retrieve_params.rb +24 -0
  63. data/lib/telnyx/models/x402/credit_account/payment_retrieve_response.rb +21 -0
  64. data/lib/telnyx/models/x402/credit_account/x402_transaction_record.rb +113 -0
  65. data/lib/telnyx/models.rb +10 -0
  66. data/lib/telnyx/resources/ai/anthropic/v1.rb +5 -1
  67. data/lib/telnyx/resources/ai/assistants/versions.rb +3 -1
  68. data/lib/telnyx/resources/ai/assistants.rb +6 -2
  69. data/lib/telnyx/resources/ai/openai/chat.rb +6 -8
  70. data/lib/telnyx/resources/ai/openai.rb +5 -1
  71. data/lib/telnyx/resources/compute/funcs.rb +141 -0
  72. data/lib/telnyx/resources/compute.rb +18 -0
  73. data/lib/telnyx/resources/email_messages.rb +4 -2
  74. data/lib/telnyx/resources/messaging_profiles.rb +12 -4
  75. data/lib/telnyx/resources/webhooks.rb +2 -2
  76. data/lib/telnyx/resources/whatsapp/phone_numbers.rb +22 -0
  77. data/lib/telnyx/resources/x402/credit_account/payments.rb +71 -0
  78. data/lib/telnyx/resources/x402/credit_account.rb +8 -2
  79. data/lib/telnyx/version.rb +1 -1
  80. data/lib/telnyx.rb +24 -0
  81. data/rbi/telnyx/client.rbi +3 -0
  82. data/rbi/telnyx/models/ai/anthropic/v1_messages_params.rbi +139 -0
  83. data/rbi/telnyx/models/ai/assistant_a2_a_agent.rbi +345 -0
  84. data/rbi/telnyx/models/ai/assistant_create_params.rbi +29 -0
  85. data/rbi/telnyx/models/ai/assistant_update_params.rbi +31 -0
  86. data/rbi/telnyx/models/ai/assistants/update_assistant.rbi +31 -0
  87. data/rbi/telnyx/models/ai/chat_completion_request.rbi +339 -91
  88. data/rbi/telnyx/models/ai/inference_embedding.rbi +29 -0
  89. data/rbi/telnyx/models/ai/openai_create_response_params.rbi +136 -0
  90. data/rbi/telnyx/models/ai/telephony_settings.rbi +23 -0
  91. data/rbi/telnyx/models/compute/func_retrieve_logs_params.rbi +130 -0
  92. data/rbi/telnyx/models/compute/func_retrieve_logs_response.rbi +410 -0
  93. data/rbi/telnyx/models/compute/func_retrieve_metric_aggregates_params.rbi +102 -0
  94. data/rbi/telnyx/models/compute/func_retrieve_metric_aggregates_response.rbi +231 -0
  95. data/rbi/telnyx/models/compute/func_retrieve_revisions_params.rbi +59 -0
  96. data/rbi/telnyx/models/compute/func_retrieve_revisions_response.rbi +213 -0
  97. data/rbi/telnyx/models/compute/func_retrieve_ship_inspection_params.rbi +40 -0
  98. data/rbi/telnyx/models/compute/func_retrieve_ship_inspection_response.rbi +252 -0
  99. data/rbi/telnyx/models/compute/functions_observability_pagination_meta.rbi +70 -0
  100. data/rbi/telnyx/models/compute/logs_meta.rbi +38 -0
  101. data/rbi/telnyx/models/credential_connection.rbi +8 -2
  102. data/rbi/telnyx/models/email_inboxes/email_message.rbi +22 -3
  103. data/rbi/telnyx/models/email_message_batch_params.rbi +6 -0
  104. data/rbi/telnyx/models/email_message_batch_response.rbi +5 -0
  105. data/rbi/telnyx/models/fqdn_connection.rbi +8 -2
  106. data/rbi/telnyx/models/fqdn_connections/fqdn_authentication.rbi +8 -2
  107. data/rbi/telnyx/models/messaging_inbound_message_payload.rbi +450 -193
  108. data/rbi/telnyx/models/messaging_messaging_profile.rbi +463 -0
  109. data/rbi/telnyx/models/messaging_profile.rbi +4 -6
  110. data/rbi/telnyx/models/messaging_profile_create_params.rbi +19 -0
  111. data/rbi/telnyx/models/messaging_profile_create_response.rbi +6 -4
  112. data/rbi/telnyx/models/messaging_profile_delete_response.rbi +6 -4
  113. data/rbi/telnyx/models/messaging_profile_features.rbi +43 -0
  114. data/rbi/telnyx/models/messaging_profile_retrieve_response.rbi +6 -4
  115. data/rbi/telnyx/models/messaging_profile_update_params.rbi +51 -0
  116. data/rbi/telnyx/models/messaging_profile_update_response.rbi +6 -4
  117. data/rbi/telnyx/models/messaging_profiles/action_regenerate_secret_response.rbi +4 -4
  118. data/rbi/telnyx/models/uac_connection.rbi +8 -2
  119. data/rbi/telnyx/models/uac_external_settings.rbi +10 -2
  120. data/rbi/telnyx/models/unsafe_unwrap_webhook_event.rbi +3 -1
  121. data/rbi/telnyx/models/unwrap_webhook_event.rbi +3 -1
  122. data/rbi/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rbi +213 -0
  123. data/rbi/telnyx/models/whatsapp/phone_number_get_response.rbi +213 -0
  124. data/rbi/telnyx/models/whatsapp/phone_number_list_response.rbi +213 -0
  125. data/rbi/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rbi +40 -0
  126. data/rbi/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rbi +401 -0
  127. data/rbi/telnyx/models/whatsapp_account_update.rbi +236 -0
  128. data/rbi/telnyx/models/whatsapp_message_echo.rbi +611 -0
  129. data/rbi/telnyx/models/x402/credit_account/payment_list_params.rbi +64 -0
  130. data/rbi/telnyx/models/x402/credit_account/payment_retrieve_params.rbi +42 -0
  131. data/rbi/telnyx/models/x402/credit_account/payment_retrieve_response.rbi +53 -0
  132. data/rbi/telnyx/models/x402/credit_account/x402_transaction_record.rbi +219 -0
  133. data/rbi/telnyx/models.rbi +10 -0
  134. data/rbi/telnyx/resources/ai/anthropic/v1.rbi +14 -0
  135. data/rbi/telnyx/resources/ai/assistants/versions.rbi +12 -0
  136. data/rbi/telnyx/resources/ai/assistants.rbi +21 -0
  137. data/rbi/telnyx/resources/ai/openai/chat.rbi +23 -13
  138. data/rbi/telnyx/resources/ai/openai.rbi +14 -0
  139. data/rbi/telnyx/resources/compute/funcs.rbi +111 -0
  140. data/rbi/telnyx/resources/compute.rbi +15 -0
  141. data/rbi/telnyx/resources/email_messages.rbi +6 -2
  142. data/rbi/telnyx/resources/messaging_profiles.rbi +24 -1
  143. data/rbi/telnyx/resources/webhooks.rbi +6 -2
  144. data/rbi/telnyx/resources/whatsapp/phone_numbers.rbi +18 -0
  145. data/rbi/telnyx/resources/x402/credit_account/payments.rbi +60 -0
  146. data/rbi/telnyx/resources/x402/credit_account.rbi +5 -0
  147. data/sig/telnyx/client.rbs +2 -0
  148. data/sig/telnyx/models/ai/anthropic/v1_messages_params.rbs +42 -0
  149. data/sig/telnyx/models/ai/assistant_a2_a_agent.rbs +140 -0
  150. data/sig/telnyx/models/ai/assistant_create_params.rbs +9 -0
  151. data/sig/telnyx/models/ai/assistant_update_params.rbs +9 -0
  152. data/sig/telnyx/models/ai/assistants/update_assistant.rbs +9 -0
  153. data/sig/telnyx/models/ai/chat_completion_request.rbs +128 -44
  154. data/sig/telnyx/models/ai/inference_embedding.rbs +9 -0
  155. data/sig/telnyx/models/ai/openai_create_response_params.rbs +42 -0
  156. data/sig/telnyx/models/ai/telephony_settings.rbs +7 -0
  157. data/sig/telnyx/models/compute/func_retrieve_logs_params.rbs +69 -0
  158. data/sig/telnyx/models/compute/func_retrieve_logs_response.rbs +210 -0
  159. data/sig/telnyx/models/compute/func_retrieve_metric_aggregates_params.rbs +66 -0
  160. data/sig/telnyx/models/compute/func_retrieve_metric_aggregates_response.rbs +149 -0
  161. data/sig/telnyx/models/compute/func_retrieve_revisions_params.rbs +38 -0
  162. data/sig/telnyx/models/compute/func_retrieve_revisions_response.rbs +131 -0
  163. data/sig/telnyx/models/compute/func_retrieve_ship_inspection_params.rbs +22 -0
  164. data/sig/telnyx/models/compute/func_retrieve_ship_inspection_response.rbs +117 -0
  165. data/sig/telnyx/models/compute/functions_observability_pagination_meta.rbs +45 -0
  166. data/sig/telnyx/models/compute/logs_meta.rbs +21 -0
  167. data/sig/telnyx/models/email_inboxes/email_message.rbs +12 -3
  168. data/sig/telnyx/models/email_message_batch_response.rbs +2 -0
  169. data/sig/telnyx/models/messaging_inbound_message_payload.rbs +207 -95
  170. data/sig/telnyx/models/messaging_messaging_profile.rbs +212 -0
  171. data/sig/telnyx/models/messaging_profile_create_params.rbs +5 -0
  172. data/sig/telnyx/models/messaging_profile_create_response.rbs +8 -5
  173. data/sig/telnyx/models/messaging_profile_delete_response.rbs +8 -5
  174. data/sig/telnyx/models/messaging_profile_features.rbs +15 -0
  175. data/sig/telnyx/models/messaging_profile_retrieve_response.rbs +7 -5
  176. data/sig/telnyx/models/messaging_profile_update_params.rbs +19 -0
  177. data/sig/telnyx/models/messaging_profile_update_response.rbs +8 -5
  178. data/sig/telnyx/models/messaging_profiles/action_regenerate_secret_response.rbs +7 -5
  179. data/sig/telnyx/models/unsafe_unwrap_webhook_event.rbs +2 -0
  180. data/sig/telnyx/models/unwrap_webhook_event.rbs +2 -0
  181. data/sig/telnyx/models/whatsapp/business_accounts/phone_number_list_response.rbs +90 -0
  182. data/sig/telnyx/models/whatsapp/phone_number_get_response.rbs +90 -0
  183. data/sig/telnyx/models/whatsapp/phone_number_list_response.rbs +90 -0
  184. data/sig/telnyx/models/whatsapp/phone_number_retrieve_phone_number_params.rbs +25 -0
  185. data/sig/telnyx/models/whatsapp/phone_number_retrieve_phone_number_response.rbs +201 -0
  186. data/sig/telnyx/models/whatsapp_account_update.rbs +107 -0
  187. data/sig/telnyx/models/whatsapp_message_echo.rbs +291 -0
  188. data/sig/telnyx/models/x402/credit_account/payment_list_params.rbs +36 -0
  189. data/sig/telnyx/models/x402/credit_account/payment_retrieve_params.rbs +27 -0
  190. data/sig/telnyx/models/x402/credit_account/payment_retrieve_response.rbs +26 -0
  191. data/sig/telnyx/models/x402/credit_account/x402_transaction_record.rbs +104 -0
  192. data/sig/telnyx/models.rbs +10 -0
  193. data/sig/telnyx/resources/ai/anthropic/v1.rbs +2 -0
  194. data/sig/telnyx/resources/ai/assistants/versions.rbs +1 -0
  195. data/sig/telnyx/resources/ai/assistants.rbs +2 -0
  196. data/sig/telnyx/resources/ai/openai/chat.rbs +3 -4
  197. data/sig/telnyx/resources/ai/openai.rbs +2 -0
  198. data/sig/telnyx/resources/compute/funcs.rbs +41 -0
  199. data/sig/telnyx/resources/compute.rbs +9 -0
  200. data/sig/telnyx/resources/messaging_profiles.rbs +5 -1
  201. data/sig/telnyx/resources/webhooks.rbs +6 -2
  202. data/sig/telnyx/resources/whatsapp/phone_numbers.rbs +5 -0
  203. data/sig/telnyx/resources/x402/credit_account/payments.rbs +22 -0
  204. data/sig/telnyx/resources/x402/credit_account.rbs +2 -0
  205. metadata +74 -2
@@ -15,6 +15,25 @@ module Telnyx
15
15
  sig { returns(String) }
16
16
  attr_accessor :assistant_id
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
@@ -353,6 +372,7 @@ module Telnyx
353
372
  sig do
354
373
  params(
355
374
  assistant_id: String,
375
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent::OrHash],
356
376
  conversation_flow: Telnyx::AI::ConversationFlowReq::OrHash,
357
377
  description: String,
358
378
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -407,6 +427,16 @@ module Telnyx
407
427
  end
408
428
  def self.new(
409
429
  assistant_id:,
430
+ # A2A agents this assistant can delegate to. Tools are not stored here: at the
431
+ # start of every conversation each agent's card is fetched and one tool is derived
432
+ # per skill the card advertises, named `a2a_<name>_<skill_id>`. The following
433
+ # limits are not enforced when the assistant is saved, and anything past them is
434
+ # dropped when the conversation starts: 64 agents per assistant, 64 skills per
435
+ # card, 128 derived tools per assistant, and a 6 second budget for all card
436
+ # fetches combined. An agent whose card cannot be fetched costs the assistant that
437
+ # capability for the conversation; it does not fail the call. Omit this field to
438
+ # leave the assistant's agents unchanged; send an empty array to remove them all.
439
+ a2a_agents: nil,
410
440
  # Conversation flow as supplied by API clients (create / update).
411
441
  #
412
442
  # A directed graph of `FlowNodeReq` connected by `FlowEdge`s. Validation enforces
@@ -511,6 +541,7 @@ module Telnyx
511
541
  override.returns(
512
542
  {
513
543
  assistant_id: String,
544
+ a2a_agents: T::Array[Telnyx::AI::AssistantA2AAgent],
514
545
  conversation_flow: Telnyx::AI::ConversationFlowReq,
515
546
  description: String,
516
547
  dynamic_variables: T::Hash[Symbol, T.anything],
@@ -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
@@ -110,6 +88,21 @@ module Telnyx
110
88
  sig { params(min_p: Float).void }
111
89
  attr_writer :min_p
112
90
 
91
+ # How strictly `region` is applied. `preferred` (the default when `region` is set)
92
+ # tries that region first and falls back to another when the model cannot be
93
+ # served there, so a request that would have succeeded still succeeds. `strict`
94
+ # pins the request: it is served from that region or it fails with a 422, never
95
+ # redirected to another region. Requires `region`.
96
+ sig do
97
+ returns(T.nilable(Telnyx::AI::ChatCompletionRequest::Mode::OrSymbol))
98
+ end
99
+ attr_reader :mode
100
+
101
+ sig do
102
+ params(mode: Telnyx::AI::ChatCompletionRequest::Mode::OrSymbol).void
103
+ end
104
+ attr_writer :mode
105
+
113
106
  # The language model to chat with.
114
107
  sig { returns(T.nilable(String)) }
115
108
  attr_reader :model
@@ -153,17 +146,50 @@ module Telnyx
153
146
  end
154
147
  attr_writer :reasoning_effort
155
148
 
156
- # Use this is you want to guarantee a JSON output without defining a schema. For
157
- # control over the schema, use `guided_json`.
149
+ # Optional data-residency region the request should be served from, using the same
150
+ # vocabulary as your account's Data Locality setting. Behavior depends on `mode`.
151
+ # Supported for Telnyx-hosted models only: a request routed to an external
152
+ # provider never passes through Telnyx model routing, so a region cannot be
153
+ # enforced for it. Omit for today's latency-based routing.
158
154
  sig do
159
- returns(T.nilable(Telnyx::AI::ChatCompletionRequest::ResponseFormat))
155
+ returns(
156
+ T.nilable(Telnyx::AI::ChatCompletionRequest::Region::OrSymbol)
157
+ )
158
+ end
159
+ attr_reader :region
160
+
161
+ sig do
162
+ params(
163
+ region: Telnyx::AI::ChatCompletionRequest::Region::OrSymbol
164
+ ).void
165
+ end
166
+ attr_writer :region
167
+
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.
172
+ sig do
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
+ )
160
182
  end
161
183
  attr_reader :response_format
162
184
 
163
185
  sig do
164
186
  params(
165
187
  response_format:
166
- 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
+ )
167
193
  ).void
168
194
  end
169
195
  attr_writer :response_format
@@ -295,20 +321,23 @@ module Telnyx
295
321
  early_stopping: T::Boolean,
296
322
  enable_thinking: T::Boolean,
297
323
  frequency_penalty: Float,
298
- guided_choice: T::Array[String],
299
- guided_json: T::Hash[Symbol, T.anything],
300
- guided_regex: String,
301
324
  length_penalty: Float,
302
325
  logprobs: T::Boolean,
303
326
  max_tokens: Integer,
304
327
  min_p: Float,
328
+ mode: Telnyx::AI::ChatCompletionRequest::Mode::OrSymbol,
305
329
  model: String,
306
330
  n: Float,
307
331
  presence_penalty: Float,
308
332
  reasoning_effort:
309
333
  Telnyx::AI::ChatCompletionRequest::ReasoningEffort::OrSymbol,
334
+ region: Telnyx::AI::ChatCompletionRequest::Region::OrSymbol,
310
335
  response_format:
311
- 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
+ ),
312
341
  seed: Integer,
313
342
  service_tier: String,
314
343
  stop: Telnyx::AI::ChatCompletionRequest::Stop::Variants,
@@ -349,13 +378,6 @@ module Telnyx
349
378
  enable_thinking: nil,
350
379
  # Higher values will penalize the model from repeating the same output tokens.
351
380
  frequency_penalty: nil,
352
- # If specified, the output will be exactly one of the choices.
353
- guided_choice: nil,
354
- # Must be a valid JSON schema. If specified, the output will follow the JSON
355
- # schema.
356
- guided_json: nil,
357
- # If specified, the output will follow the regex pattern.
358
- guided_regex: nil,
359
381
  # This is used with `use_beam_search` to prefer shorter or longer completions.
360
382
  length_penalty: nil,
361
383
  # Whether to return log probabilities of the output tokens or not. If true,
@@ -368,6 +390,12 @@ module Telnyx
368
390
  # [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
369
391
  # in [0, 1].
370
392
  min_p: nil,
393
+ # How strictly `region` is applied. `preferred` (the default when `region` is set)
394
+ # tries that region first and falls back to another when the model cannot be
395
+ # served there, so a request that would have succeeded still succeeds. `strict`
396
+ # pins the request: it is served from that region or it fails with a 422, never
397
+ # redirected to another region. Requires `region`.
398
+ mode: nil,
371
399
  # The language model to chat with.
372
400
  model: nil,
373
401
  # This will return multiple choices for you instead of a single chat completion.
@@ -380,8 +408,16 @@ module Telnyx
380
408
  # all models support all values; unsupported values are rejected with a 400 error.
381
409
  # When omitted, reasoning models use their default effort level.
382
410
  reasoning_effort: nil,
383
- # Use this is you want to guarantee a JSON output without defining a schema. For
384
- # control over the schema, use `guided_json`.
411
+ # Optional data-residency region the request should be served from, using the same
412
+ # vocabulary as your account's Data Locality setting. Behavior depends on `mode`.
413
+ # Supported for Telnyx-hosted models only: a request routed to an external
414
+ # provider never passes through Telnyx model routing, so a region cannot be
415
+ # enforced for it. Omit for today's latency-based routing.
416
+ region: nil,
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.
385
421
  response_format: nil,
386
422
  # If specified, the system will make a best effort to sample deterministically,
387
423
  # such that repeated requests with the same `seed` and parameters should return
@@ -430,20 +466,23 @@ module Telnyx
430
466
  early_stopping: T::Boolean,
431
467
  enable_thinking: T::Boolean,
432
468
  frequency_penalty: Float,
433
- guided_choice: T::Array[String],
434
- guided_json: T::Hash[Symbol, T.anything],
435
- guided_regex: String,
436
469
  length_penalty: Float,
437
470
  logprobs: T::Boolean,
438
471
  max_tokens: Integer,
439
472
  min_p: Float,
473
+ mode: Telnyx::AI::ChatCompletionRequest::Mode::OrSymbol,
440
474
  model: String,
441
475
  n: Float,
442
476
  presence_penalty: Float,
443
477
  reasoning_effort:
444
478
  Telnyx::AI::ChatCompletionRequest::ReasoningEffort::OrSymbol,
479
+ region: Telnyx::AI::ChatCompletionRequest::Region::OrSymbol,
445
480
  response_format:
446
- 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
+ ),
447
486
  seed: Integer,
448
487
  service_tier: String,
449
488
  stop: Telnyx::AI::ChatCompletionRequest::Stop::Variants,
@@ -671,6 +710,40 @@ module Telnyx
671
710
  end
672
711
  end
673
712
 
713
+ # How strictly `region` is applied. `preferred` (the default when `region` is set)
714
+ # tries that region first and falls back to another when the model cannot be
715
+ # served there, so a request that would have succeeded still succeeds. `strict`
716
+ # pins the request: it is served from that region or it fails with a 422, never
717
+ # redirected to another region. Requires `region`.
718
+ module Mode
719
+ extend Telnyx::Internal::Type::Enum
720
+
721
+ TaggedSymbol =
722
+ T.type_alias do
723
+ T.all(Symbol, Telnyx::AI::ChatCompletionRequest::Mode)
724
+ end
725
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
726
+
727
+ PREFERRED =
728
+ T.let(
729
+ :preferred,
730
+ Telnyx::AI::ChatCompletionRequest::Mode::TaggedSymbol
731
+ )
732
+ STRICT =
733
+ T.let(
734
+ :strict,
735
+ Telnyx::AI::ChatCompletionRequest::Mode::TaggedSymbol
736
+ )
737
+
738
+ sig do
739
+ override.returns(
740
+ T::Array[Telnyx::AI::ChatCompletionRequest::Mode::TaggedSymbol]
741
+ )
742
+ end
743
+ def self.values
744
+ end
745
+ end
746
+
674
747
  # Controls the reasoning effort for models that support it. When set, the model
675
748
  # spends more or less compute on internal reasoning before generating its
676
749
  # response. Supported values: none, minimal, low, medium, high, xhigh, max. Not
@@ -732,77 +805,252 @@ module Telnyx
732
805
  end
733
806
  end
734
807
 
735
- class ResponseFormat < Telnyx::Internal::Type::BaseModel
736
- OrHash =
808
+ # Optional data-residency region the request should be served from, using the same
809
+ # vocabulary as your account's Data Locality setting. Behavior depends on `mode`.
810
+ # Supported for Telnyx-hosted models only: a request routed to an external
811
+ # provider never passes through Telnyx model routing, so a region cannot be
812
+ # enforced for it. Omit for today's latency-based routing.
813
+ module Region
814
+ extend Telnyx::Internal::Type::Enum
815
+
816
+ TaggedSymbol =
737
817
  T.type_alias do
738
- T.any(
739
- Telnyx::AI::ChatCompletionRequest::ResponseFormat,
740
- Telnyx::Internal::AnyHash
741
- )
818
+ T.all(Symbol, Telnyx::AI::ChatCompletionRequest::Region)
742
819
  end
820
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
743
821
 
744
- sig do
745
- returns(
746
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
747
- )
748
- end
749
- attr_accessor :type
750
-
751
- # Use this is you want to guarantee a JSON output without defining a schema. For
752
- # control over the schema, use `guided_json`.
753
- sig do
754
- params(
755
- type:
756
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
757
- ).returns(T.attached_class)
758
- end
759
- def self.new(type:)
760
- end
822
+ USA =
823
+ T.let(:USA, Telnyx::AI::ChatCompletionRequest::Region::TaggedSymbol)
824
+ EU =
825
+ T.let(:EU, Telnyx::AI::ChatCompletionRequest::Region::TaggedSymbol)
826
+ AUS =
827
+ T.let(:AUS, Telnyx::AI::ChatCompletionRequest::Region::TaggedSymbol)
828
+ UAE =
829
+ T.let(:UAE, Telnyx::AI::ChatCompletionRequest::Region::TaggedSymbol)
761
830
 
762
831
  sig do
763
832
  override.returns(
764
- {
765
- type:
766
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::OrSymbol
767
- }
833
+ T::Array[Telnyx::AI::ChatCompletionRequest::Region::TaggedSymbol]
768
834
  )
769
835
  end
770
- def to_hash
836
+ def self.values
771
837
  end
838
+ end
772
839
 
773
- module Type
774
- extend Telnyx::Internal::Type::Enum
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
775
846
 
776
- TaggedSymbol =
847
+ Variants =
848
+ T.type_alias do
849
+ T.any(
850
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
851
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonObject,
852
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam
853
+ )
854
+ end
855
+
856
+ class ResponseFormatText < Telnyx::Internal::Type::BaseModel
857
+ OrHash =
777
858
  T.type_alias do
778
- T.all(
779
- Symbol,
780
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type
859
+ T.any(
860
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatText,
861
+ Telnyx::Internal::AnyHash
781
862
  )
782
863
  end
783
- OrSymbol = T.type_alias { T.any(Symbol, String) }
784
864
 
785
- TEXT =
786
- T.let(
787
- :text,
788
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
789
- )
790
- JSON_OBJECT =
791
- T.let(
792
- :json_object,
793
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
865
+ sig { returns(Symbol) }
866
+ attr_accessor :type
867
+
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
876
+ end
877
+
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
886
+
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 =
902
+ T.type_alias do
903
+ T.any(
904
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam,
905
+ Telnyx::Internal::AnyHash
906
+ )
907
+ end
908
+
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
794
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
795
949
 
796
950
  sig do
797
951
  override.returns(
798
- T::Array[
799
- Telnyx::AI::ChatCompletionRequest::ResponseFormat::Type::TaggedSymbol
800
- ]
952
+ {
953
+ json_schema:
954
+ Telnyx::AI::ChatCompletionRequest::ResponseFormat::ResponseFormatJsonSchemaParam::JsonSchema,
955
+ type: Symbol
956
+ }
801
957
  )
802
958
  end
803
- def self.values
959
+ def to_hash
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
804
1042
  end
805
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
1053
+ end
806
1054
  end
807
1055
 
808
1056
  # Up to 4 sequences where the API will stop generating further tokens. The