telnyx 5.163.0 → 5.165.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +1 -1
- data/lib/telnyx/client.rb +4 -5
- data/lib/telnyx/lib/webhook_verification.rb +54 -155
- data/lib/telnyx/lib.rb +3 -1
- data/lib/telnyx/models/ai/anthropic/v1_messages_params.rb +4 -3
- data/lib/telnyx/models/ai/assistant_tool.rb +106 -2
- data/lib/telnyx/models/ai/chat_completion_request.rb +35 -1
- data/lib/telnyx/models/ai/collections/retrieval_settings.rb +6 -1
- data/lib/telnyx/models/ai/inference_embedding_webhook_tool_params.rb +30 -1
- data/lib/telnyx/models/ai/knowledge/collection_retrieve_documents_params.rb +114 -0
- data/lib/telnyx/models/ai/knowledge/collection_retrieve_documents_response.rb +182 -0
- data/lib/telnyx/models/ai/openai_create_response_params.rb +42 -1
- data/lib/telnyx/models/ai/telephony_settings.rb +16 -1
- data/lib/telnyx/models/ai/transcription_settings.rb +23 -13
- data/lib/telnyx/models/ai/transcription_settings_config.rb +35 -10
- data/lib/telnyx/models/call_dial_params.rb +13 -1
- data/lib/telnyx/models/calls/action_gather_params.rb +2 -1
- data/lib/telnyx/models/calls/action_gather_using_audio_params.rb +2 -1
- data/lib/telnyx/models/calls/action_gather_using_speak_params.rb +2 -1
- data/lib/telnyx/models/calls/action_start_ai_assistant_params.rb +5 -3
- data/lib/telnyx/models/calls/action_transfer_params.rb +13 -1
- data/lib/telnyx/models/calls/transcription_config.rb +6 -1
- data/lib/telnyx/models/calls/transcription_engine_cohere_config.rb +78 -0
- data/lib/telnyx/models/calls/transcription_start_request.rb +6 -3
- data/lib/telnyx/models/conferences/action_gather_dtmf_audio_params.rb +4 -2
- data/lib/telnyx/models/connection_rtcp_settings.rb +3 -3
- data/lib/telnyx/models/credential_connections/action_check_registration_status_response.rb +12 -12
- data/lib/telnyx/models/external_requirements/sub_number_order_retrieve_params.rb +28 -0
- data/lib/telnyx/models/external_requirements/sub_number_order_retrieve_response.rb +104 -0
- data/lib/telnyx/models/external_requirements/sub_number_order_update_params.rb +69 -0
- data/lib/telnyx/models/external_requirements/sub_number_order_update_response.rb +66 -0
- data/lib/telnyx/models/outbound_voice_profile.rb +14 -14
- data/lib/telnyx/models/outbound_voice_profile_create_params.rb +14 -14
- data/lib/telnyx/models/outbound_voice_profile_update_params.rb +14 -14
- data/lib/telnyx/models/phone_numbers/job_list_params.rb +67 -4
- data/lib/telnyx/models/sim_card_groups/sim_card_group_action.rb +9 -1
- data/lib/telnyx/models/speech_to_text_list_providers_params.rb +1 -0
- data/lib/telnyx/models/speech_to_text_retrieve_transcription_params.rb +19 -3
- data/lib/telnyx/models/transcription.rb +4 -3
- data/lib/telnyx/models/uac_connections/action_check_registration_status_response.rb +12 -12
- data/lib/telnyx/models/wireless_blocklist.rb +0 -1
- data/lib/telnyx/models/wireless_blocklist_create_response.rb +3 -3
- data/lib/telnyx/models/wireless_blocklist_list_params.rb +1 -9
- data/lib/telnyx/models/wireless_blocklist_retrieve_response.rb +3 -3
- data/lib/telnyx/models/wireless_blocklist_update_response.rb +3 -3
- data/lib/telnyx/models/wireless_blocklist_value_list_response.rb +15 -45
- data/lib/telnyx/models/wireless_wireless_blocklist.rb +73 -0
- data/lib/telnyx/models.rb +4 -2
- data/lib/telnyx/resources/ai/anthropic/v1.rb +1 -1
- data/lib/telnyx/resources/ai/collections.rb +0 -69
- data/lib/telnyx/resources/ai/knowledge/collections.rb +92 -0
- data/lib/telnyx/resources/ai/knowledge.rb +22 -0
- data/lib/telnyx/resources/ai/openai/chat.rb +3 -1
- data/lib/telnyx/resources/ai/openai.rb +3 -1
- data/lib/telnyx/resources/ai.rb +4 -0
- data/lib/telnyx/resources/calls/actions.rb +5 -3
- data/lib/telnyx/resources/calls.rb +3 -1
- data/lib/telnyx/resources/conferences/actions.rb +1 -1
- data/lib/telnyx/resources/credential_connections/actions.rb +3 -3
- data/lib/telnyx/resources/external_requirements/sub_number_orders.rb +99 -0
- data/lib/telnyx/resources/external_requirements.rb +19 -0
- data/lib/telnyx/resources/outbound_voice_profiles.rb +2 -2
- data/lib/telnyx/resources/phone_numbers/jobs.rb +5 -3
- data/lib/telnyx/resources/sim_card_groups/actions.rb +6 -4
- data/lib/telnyx/resources/speech_to_text.rb +7 -4
- data/lib/telnyx/resources/uac_connections/actions.rb +3 -3
- data/lib/telnyx/resources/webhooks.rb +1 -1
- data/lib/telnyx/resources/wireless_blocklist_values.rb +2 -1
- data/lib/telnyx/resources/wireless_blocklists.rb +8 -9
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx.rb +12 -7
- data/rbi/telnyx/client.rbi +3 -4
- data/rbi/telnyx/models/ai/anthropic/v1_messages_params.rbi +6 -4
- data/rbi/telnyx/models/ai/assistant_tool.rbi +206 -2
- data/rbi/telnyx/models/ai/chat_completion_request.rbi +93 -0
- data/rbi/telnyx/models/ai/collections/retrieval_settings.rbi +9 -5
- data/rbi/telnyx/models/ai/inference_embedding_webhook_tool_params.rbi +48 -0
- data/rbi/telnyx/models/ai/knowledge/collection_retrieve_documents_params.rbi +206 -0
- data/rbi/telnyx/models/ai/knowledge/collection_retrieve_documents_response.rbi +336 -0
- data/rbi/telnyx/models/ai/openai_create_response_params.rbi +130 -0
- data/rbi/telnyx/models/ai/telephony_settings.rbi +25 -0
- data/rbi/telnyx/models/ai/transcription_settings.rbi +48 -24
- data/rbi/telnyx/models/ai/transcription_settings_config.rbi +52 -12
- data/rbi/telnyx/models/call_dial_params.rbi +19 -0
- data/rbi/telnyx/models/calls/action_gather_params.rbi +4 -2
- data/rbi/telnyx/models/calls/action_gather_using_audio_params.rbi +4 -2
- data/rbi/telnyx/models/calls/action_gather_using_speak_params.rbi +4 -2
- data/rbi/telnyx/models/calls/action_start_ai_assistant_params.rbi +8 -4
- data/rbi/telnyx/models/calls/action_transfer_params.rbi +19 -0
- data/rbi/telnyx/models/calls/transcription_config.rbi +14 -2
- data/rbi/telnyx/models/calls/transcription_engine_cohere_config.rbi +204 -0
- data/rbi/telnyx/models/calls/transcription_start_request.rbi +10 -0
- data/rbi/telnyx/models/conferences/action_gather_dtmf_audio_params.rbi +6 -2
- data/rbi/telnyx/models/connection_rtcp_settings.rbi +4 -4
- data/rbi/telnyx/models/credential_connections/action_check_registration_status_response.rbi +18 -36
- data/rbi/telnyx/models/external_requirements/sub_number_order_retrieve_params.rbi +52 -0
- data/rbi/telnyx/models/external_requirements/sub_number_order_retrieve_response.rbi +248 -0
- data/rbi/telnyx/models/external_requirements/sub_number_order_update_params.rbi +119 -0
- data/rbi/telnyx/models/external_requirements/sub_number_order_update_response.rbi +159 -0
- data/rbi/telnyx/models/outbound_voice_profile.rbi +18 -18
- data/rbi/telnyx/models/outbound_voice_profile_create_params.rbi +18 -18
- data/rbi/telnyx/models/outbound_voice_profile_update_params.rbi +18 -18
- data/rbi/telnyx/models/phone_numbers/job_list_params.rbi +148 -3
- data/rbi/telnyx/models/sim_card_groups/sim_card_group_action.rbi +22 -5
- data/rbi/telnyx/models/speech_to_text_list_providers_params.rbi +5 -0
- data/rbi/telnyx/models/speech_to_text_retrieve_transcription_params.rbi +41 -2
- data/rbi/telnyx/models/transcription.rbi +7 -8
- data/rbi/telnyx/models/uac_connections/action_check_registration_status_response.rbi +18 -36
- data/rbi/telnyx/models/wireless_blocklist.rbi +2 -2
- data/rbi/telnyx/models/wireless_blocklist_create_response.rbi +4 -4
- data/rbi/telnyx/models/wireless_blocklist_list_params.rbi +0 -11
- data/rbi/telnyx/models/wireless_blocklist_retrieve_response.rbi +4 -4
- data/rbi/telnyx/models/wireless_blocklist_update_response.rbi +4 -4
- data/rbi/telnyx/models/wireless_blocklist_value_list_response.rbi +16 -52
- data/rbi/telnyx/models/wireless_wireless_blocklist.rbi +126 -0
- data/rbi/telnyx/models.rbi +4 -3
- data/rbi/telnyx/resources/ai/anthropic/v1.rbi +3 -2
- data/rbi/telnyx/resources/ai/collections.rbi +0 -77
- data/rbi/telnyx/resources/ai/knowledge/collections.rbi +99 -0
- data/rbi/telnyx/resources/ai/knowledge.rbi +19 -0
- data/rbi/telnyx/resources/ai/openai/chat.rbi +8 -0
- data/rbi/telnyx/resources/ai/openai.rbi +3 -0
- data/rbi/telnyx/resources/ai.rbi +3 -0
- data/rbi/telnyx/resources/calls/actions.rbi +18 -5
- data/rbi/telnyx/resources/calls.rbi +7 -0
- data/rbi/telnyx/resources/conferences/actions.rbi +3 -1
- data/rbi/telnyx/resources/credential_connections/actions.rbi +3 -3
- data/rbi/telnyx/resources/external_requirements/sub_number_orders.rbi +71 -0
- data/rbi/telnyx/resources/external_requirements.rbi +16 -0
- data/rbi/telnyx/resources/outbound_voice_profiles.rbi +4 -4
- data/rbi/telnyx/resources/phone_numbers/jobs.rbi +6 -3
- data/rbi/telnyx/resources/sim_card_groups/actions.rbi +6 -4
- data/rbi/telnyx/resources/speech_to_text.rbi +11 -3
- data/rbi/telnyx/resources/uac_connections/actions.rbi +3 -3
- data/rbi/telnyx/resources/wireless_blocklist_values.rbi +2 -1
- data/rbi/telnyx/resources/wireless_blocklists.rbi +7 -9
- data/sig/telnyx/client.rbs +2 -2
- data/sig/telnyx/models/ai/assistant_tool.rbs +66 -3
- data/sig/telnyx/models/ai/chat_completion_request.rbs +26 -0
- data/sig/telnyx/models/ai/collections/retrieval_settings.rbs +1 -2
- data/sig/telnyx/models/ai/inference_embedding_webhook_tool_params.rbs +14 -0
- data/sig/telnyx/models/ai/knowledge/collection_retrieve_documents_params.rbs +93 -0
- data/sig/telnyx/models/ai/knowledge/collection_retrieve_documents_response.rbs +208 -0
- data/sig/telnyx/models/ai/openai_create_response_params.rbs +47 -0
- data/sig/telnyx/models/ai/telephony_settings.rbs +7 -0
- data/sig/telnyx/models/ai/transcription_settings.rbs +4 -0
- data/sig/telnyx/models/ai/transcription_settings_config.rbs +14 -0
- data/sig/telnyx/models/call_dial_params.rbs +7 -0
- data/sig/telnyx/models/calls/action_transfer_params.rbs +7 -0
- data/sig/telnyx/models/calls/transcription_config.rbs +2 -0
- data/sig/telnyx/models/calls/transcription_engine_cohere_config.rbs +75 -0
- data/sig/telnyx/models/calls/transcription_start_request.rbs +3 -0
- data/sig/telnyx/models/credential_connections/action_check_registration_status_response.rbs +24 -36
- data/sig/telnyx/models/external_requirements/sub_number_order_retrieve_params.rbs +30 -0
- data/sig/telnyx/models/external_requirements/sub_number_order_retrieve_response.rbs +110 -0
- data/sig/telnyx/models/external_requirements/sub_number_order_update_params.rbs +50 -0
- data/sig/telnyx/models/external_requirements/sub_number_order_update_response.rbs +75 -0
- data/sig/telnyx/models/phone_numbers/job_list_params.rbs +46 -1
- data/sig/telnyx/models/sim_card_groups/sim_card_group_action.rbs +14 -3
- data/sig/telnyx/models/speech_to_text_list_providers_params.rbs +2 -0
- data/sig/telnyx/models/speech_to_text_retrieve_transcription_params.rbs +15 -2
- data/sig/telnyx/models/transcription.rbs +4 -6
- data/sig/telnyx/models/uac_connections/action_check_registration_status_response.rbs +24 -36
- data/sig/telnyx/models/wireless_blocklist_create_response.rbs +7 -5
- data/sig/telnyx/models/wireless_blocklist_list_params.rbs +0 -7
- data/sig/telnyx/models/wireless_blocklist_retrieve_response.rbs +7 -5
- data/sig/telnyx/models/wireless_blocklist_update_response.rbs +7 -5
- data/sig/telnyx/models/wireless_blocklist_value_list_response.rbs +16 -35
- data/sig/telnyx/models/wireless_wireless_blocklist.rbs +71 -0
- data/sig/telnyx/models.rbs +4 -2
- data/sig/telnyx/resources/ai/collections.rbs +0 -12
- data/sig/telnyx/resources/ai/knowledge/collections.rbs +23 -0
- data/sig/telnyx/resources/ai/knowledge.rbs +11 -0
- data/sig/telnyx/resources/ai/openai/chat.rbs +1 -0
- data/sig/telnyx/resources/ai/openai.rbs +1 -0
- data/sig/telnyx/resources/ai.rbs +2 -0
- data/sig/telnyx/resources/calls/actions.rbs +1 -0
- data/sig/telnyx/resources/calls.rbs +1 -0
- data/sig/telnyx/resources/external_requirements/sub_number_orders.rbs +22 -0
- data/sig/telnyx/resources/external_requirements.rbs +9 -0
- data/sig/telnyx/resources/speech_to_text.rbs +1 -0
- data/sig/telnyx/resources/wireless_blocklists.rbs +2 -6
- metadata +38 -21
- data/lib/telnyx/lib/webhooks_ed25519.rb +0 -63
- data/lib/telnyx/models/ai/collection_retrieve_documents_params.rb +0 -104
- data/lib/telnyx/models/ai/collection_retrieve_documents_response.rb +0 -109
- data/lib/telnyx/models/sip_registration_status_retrieve_params.rb +0 -59
- data/lib/telnyx/models/sip_registration_status_retrieve_response.rb +0 -214
- data/lib/telnyx/models/wireless_blocklist_delete_response.rb +0 -16
- data/lib/telnyx/resources/sip_registration_status.rb +0 -59
- data/rbi/telnyx/models/ai/collection_retrieve_documents_params.rbi +0 -195
- data/rbi/telnyx/models/ai/collection_retrieve_documents_response.rbi +0 -159
- data/rbi/telnyx/models/sip_registration_status_retrieve_params.rbi +0 -124
- data/rbi/telnyx/models/sip_registration_status_retrieve_response.rbi +0 -416
- data/rbi/telnyx/models/wireless_blocklist_delete_response.rbi +0 -33
- data/rbi/telnyx/resources/sip_registration_status.rbi +0 -52
- data/sig/telnyx/models/ai/collection_retrieve_documents_params.rbs +0 -91
- data/sig/telnyx/models/ai/collection_retrieve_documents_response.rbs +0 -108
- data/sig/telnyx/models/sip_registration_status_retrieve_params.rbs +0 -55
- data/sig/telnyx/models/sip_registration_status_retrieve_response.rbs +0 -195
- data/sig/telnyx/models/wireless_blocklist_delete_response.rbs +0 -16
- data/sig/telnyx/resources/sip_registration_status.rbs +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0599a5281ad206a21c41f29f139876ab91b6596c4403c2c1fd265a98b0b26c10'
|
|
4
|
+
data.tar.gz: 1d2a0cf55be8f93d2f638e8a1140316b3c052cdaf805740669efbf459e45da9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 881615fb8ac4ba023d747d946aea0de2ad2f8aabe41bce223c6908fa2f389b961800bfdab0b4f8c3cb219cdbb1f90a99d65c10ef47b68cb8fd87a68fef870ee0
|
|
7
|
+
data.tar.gz: 6c943fc02c098ebfde7ac90194979745ba78c62ed6e901a2a1e57df06983dda31a51891aea5c87679b17fd21e89d9a27931ef86a00bd7612cfdd89b5b70e9733
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.165.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.164.0...v5.165.0) (2026-09-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* promote from staging 9d1efe7 ([d16fd9d](https://github.com/team-telnyx/telnyx-ruby/commit/d16fd9d7cff7b0205653440a32023153b7710b1f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **ci:** retry transient Steep API errors ([#355](https://github.com/team-telnyx/telnyx-ruby/issues/355)) ([25ec469](https://github.com/team-telnyx/telnyx-ruby/commit/25ec4693e5110cdc0bf7849c8cdcfab7ac1d46ce))
|
|
14
|
+
* **ci:** skip post-merge release readiness ([#352](https://github.com/team-telnyx/telnyx-ruby/issues/352)) ([bed03fd](https://github.com/team-telnyx/telnyx-ruby/commit/bed03fd1c162112e4a1f254687d0c5ca9d42cef8))
|
|
15
|
+
|
|
16
|
+
## [5.164.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.163.0...v5.164.0) (2026-08-31)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* promote from staging 88d5491 ([d62cbe6](https://github.com/team-telnyx/telnyx-ruby/commit/d62cbe641c502f1f69a2fcca8089f3f6ff72ae91))
|
|
22
|
+
|
|
3
23
|
## [5.163.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.162.0...v5.163.0) (2026-08-21)
|
|
4
24
|
|
|
5
25
|
|
data/README.md
CHANGED
data/lib/telnyx/client.rb
CHANGED
|
@@ -672,10 +672,6 @@ module Telnyx
|
|
|
672
672
|
# @return [Telnyx::Resources::VoiceSDKCallReports]
|
|
673
673
|
attr_reader :voice_sdk_call_reports
|
|
674
674
|
|
|
675
|
-
# UAC connection operations
|
|
676
|
-
# @return [Telnyx::Resources::SipRegistrationStatus]
|
|
677
|
-
attr_reader :sip_registration_status
|
|
678
|
-
|
|
679
675
|
# Static reference values the API accepts: call reasons, document types, rejection
|
|
680
676
|
# types.
|
|
681
677
|
# @return [Telnyx::Resources::CallReasons]
|
|
@@ -736,6 +732,9 @@ module Telnyx
|
|
|
736
732
|
# @return [Telnyx::Resources::MeetingSessions]
|
|
737
733
|
attr_reader :meeting_sessions
|
|
738
734
|
|
|
735
|
+
# @return [Telnyx::Resources::ExternalRequirements]
|
|
736
|
+
attr_reader :external_requirements
|
|
737
|
+
|
|
739
738
|
# @api private
|
|
740
739
|
#
|
|
741
740
|
# @return [Hash{String=>String}]
|
|
@@ -1011,7 +1010,6 @@ module Telnyx
|
|
|
1011
1010
|
@pronunciation_dicts = Telnyx::Resources::PronunciationDicts.new(client: self)
|
|
1012
1011
|
@uac_connections = Telnyx::Resources::UacConnections.new(client: self)
|
|
1013
1012
|
@voice_sdk_call_reports = Telnyx::Resources::VoiceSDKCallReports.new(client: self)
|
|
1014
|
-
@sip_registration_status = Telnyx::Resources::SipRegistrationStatus.new(client: self)
|
|
1015
1013
|
@call_reasons = Telnyx::Resources::CallReasons.new(client: self)
|
|
1016
1014
|
@dir = Telnyx::Resources::Dir.new(client: self)
|
|
1017
1015
|
@infringement_claims = Telnyx::Resources::InfringementClaims.new(client: self)
|
|
@@ -1027,6 +1025,7 @@ module Telnyx
|
|
|
1027
1025
|
@pricing = Telnyx::Resources::Pricing.new(client: self)
|
|
1028
1026
|
@web_search = Telnyx::Resources::WebSearch.new(client: self)
|
|
1029
1027
|
@meeting_sessions = Telnyx::Resources::MeetingSessions.new(client: self)
|
|
1028
|
+
@external_requirements = Telnyx::Resources::ExternalRequirements.new(client: self)
|
|
1030
1029
|
end
|
|
1031
1030
|
end
|
|
1032
1031
|
end
|
|
@@ -2,183 +2,82 @@
|
|
|
2
2
|
|
|
3
3
|
require "base64"
|
|
4
4
|
require "openssl"
|
|
5
|
-
require_relative "webhook_verification_error"
|
|
6
5
|
|
|
7
6
|
module Telnyx
|
|
8
7
|
module Lib
|
|
9
|
-
# Telnyx webhook verification
|
|
10
|
-
#
|
|
11
|
-
# This module provides ED25519 signature verification for Telnyx webhooks,
|
|
12
|
-
# matching the implementation pattern used in the Python and Node SDKs.
|
|
13
|
-
#
|
|
14
|
-
# The module is kept separate from generated code to avoid merge conflicts
|
|
15
|
-
# when Stainless updates webhook event types.
|
|
16
|
-
#
|
|
17
|
-
# Example usage:
|
|
18
|
-
#
|
|
19
|
-
# client = Telnyx::Client.new(
|
|
20
|
-
# api_key: ENV["TELNYX_API_KEY"],
|
|
21
|
-
# public_key: ENV["TELNYX_PUBLIC_KEY"] # Base64 from Mission Control
|
|
22
|
-
# )
|
|
23
|
-
#
|
|
24
|
-
# # Verify signature only
|
|
25
|
-
# client.webhooks.verify!(payload, headers)
|
|
26
|
-
#
|
|
27
|
-
# # Verify and parse
|
|
28
|
-
# event = client.webhooks.unwrap(payload, headers)
|
|
29
|
-
#
|
|
8
|
+
# Telnyx Ed25519 webhook verification over the exact raw payload bytes.
|
|
30
9
|
module WebhookVerification
|
|
31
|
-
# Telnyx webhook signature headers (case-insensitive per HTTP spec)
|
|
32
10
|
SIGNATURE_HEADER = "telnyx-signature-ed25519"
|
|
33
11
|
TIMESTAMP_HEADER = "telnyx-timestamp"
|
|
12
|
+
DEFAULT_TOLERANCE = 300
|
|
13
|
+
ED25519_SPKI_PREFIX = ["302a300506032b6570032100"].pack("H*").freeze
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
# Verify a Telnyx webhook signature before the caller parses the payload.
|
|
17
|
+
#
|
|
18
|
+
# @param payload [String] exact raw request body
|
|
19
|
+
# @param headers [Hash] request headers (looked up case-insensitively)
|
|
20
|
+
# @param public_key [String] Base64-encoded raw 32-byte Ed25519 public key
|
|
21
|
+
# @return [true]
|
|
22
|
+
# @raise [Telnyx::Errors::WebhookVerificationError] if verification fails
|
|
23
|
+
def verify_signature!(payload, headers, public_key)
|
|
24
|
+
signature_header = get_header(headers, SIGNATURE_HEADER)
|
|
25
|
+
timestamp = get_header(headers, TIMESTAMP_HEADER)
|
|
26
|
+
|
|
27
|
+
fail_verification("Missing required header: telnyx-signature-ed25519") if signature_header.nil? || signature_header.empty?
|
|
28
|
+
fail_verification("Missing required header: telnyx-timestamp") if timestamp.nil? || timestamp.empty?
|
|
29
|
+
fail_verification("Public key is required for webhook verification") if public_key.nil? || public_key.empty?
|
|
30
|
+
|
|
31
|
+
timestamp_int = parse_timestamp(timestamp)
|
|
32
|
+
if (Time.now.to_i - timestamp_int).abs > DEFAULT_TOLERANCE
|
|
33
|
+
fail_verification("Webhook timestamp is too old or too far in the future")
|
|
34
|
+
end
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# Verify webhook signature without parsing the payload.
|
|
39
|
-
#
|
|
40
|
-
# @param payload [String] The raw webhook payload
|
|
41
|
-
# @param headers [Hash] The webhook headers
|
|
42
|
-
# @param key [String, nil] Optional public key override (base64-encoded)
|
|
43
|
-
#
|
|
44
|
-
# @return [void]
|
|
45
|
-
#
|
|
46
|
-
# @raise [Telnyx::Errors::WebhookVerificationError] If verification fails
|
|
47
|
-
def verify!(payload, headers, key: nil)
|
|
48
|
-
public_key = key || @client.public_key
|
|
49
|
-
|
|
50
|
-
unless public_key && !public_key.empty?
|
|
51
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
52
|
-
message: "No public key configured. Provide key parameter or configure client with public_key."
|
|
53
|
-
)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
do_verify_signature(payload, headers, public_key)
|
|
57
|
-
end
|
|
36
|
+
key = parse_public_key(public_key)
|
|
37
|
+
signature = Base64.strict_decode64(signature_header)
|
|
38
|
+
signed_payload = "#{timestamp}|#{payload}"
|
|
58
39
|
|
|
59
|
-
|
|
40
|
+
fail_verification("Invalid webhook signature") unless key.verify(nil, signature, signed_payload)
|
|
60
41
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return header_value if header_key.to_s.downcase == key_lower
|
|
42
|
+
true
|
|
43
|
+
rescue Telnyx::Errors::WebhookVerificationError
|
|
44
|
+
raise
|
|
45
|
+
rescue ArgumentError => e
|
|
46
|
+
fail_verification("Invalid webhook signature or public key encoding: #{e.message}")
|
|
47
|
+
rescue OpenSSL::PKey::PKeyError => e
|
|
48
|
+
fail_verification("Invalid Ed25519 public key: #{e.message}")
|
|
49
|
+
rescue OpenSSL::OpenSSLError => e
|
|
50
|
+
fail_verification("Webhook verification failed: #{e.message}")
|
|
71
51
|
end
|
|
72
|
-
nil
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Verify the webhook signature using ED25519 cryptography
|
|
76
|
-
#
|
|
77
|
-
# @param payload [String] The raw webhook payload
|
|
78
|
-
# @param headers [Hash] The webhook headers
|
|
79
|
-
# @param public_key [String] The ED25519 public key (base64-encoded)
|
|
80
|
-
#
|
|
81
|
-
# @raise [Telnyx::Errors::WebhookVerificationError] If verification fails
|
|
82
|
-
def do_verify_signature(payload, headers, public_key)
|
|
83
|
-
# Extract required headers (case-insensitive)
|
|
84
|
-
signature_header = get_header(headers, SIGNATURE_HEADER)
|
|
85
|
-
timestamp_header = get_header(headers, TIMESTAMP_HEADER)
|
|
86
52
|
|
|
87
|
-
|
|
88
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
89
|
-
message: "Missing required header: #{SIGNATURE_HEADER}"
|
|
90
|
-
)
|
|
91
|
-
end
|
|
53
|
+
private
|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
95
|
-
message: "Missing required header: #{TIMESTAMP_HEADER}"
|
|
96
|
-
)
|
|
55
|
+
def fail_verification(message)
|
|
56
|
+
raise Telnyx::Errors::WebhookVerificationError.new(message: message)
|
|
97
57
|
end
|
|
98
58
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
current_time = Time.now.to_i
|
|
103
|
-
time_diff = (current_time - webhook_time).abs
|
|
104
|
-
|
|
105
|
-
if time_diff > TIMESTAMP_TOLERANCE_SECONDS
|
|
106
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
107
|
-
message: "Webhook timestamp is too old or too new (#{time_diff}s difference)"
|
|
108
|
-
)
|
|
59
|
+
def get_header(headers, name)
|
|
60
|
+
headers.each do |key, value|
|
|
61
|
+
return value if key.to_s.downcase == name
|
|
109
62
|
end
|
|
110
|
-
|
|
111
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
112
|
-
message: "Invalid timestamp format: #{timestamp_header}"
|
|
113
|
-
)
|
|
63
|
+
nil
|
|
114
64
|
end
|
|
115
65
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if public_key_bytes.bytesize != 32
|
|
121
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
122
|
-
message: "Invalid public key: expected 32 bytes, got #{public_key_bytes.bytesize} bytes"
|
|
123
|
-
)
|
|
124
|
-
end
|
|
125
|
-
rescue ArgumentError => e
|
|
126
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
127
|
-
message: "Invalid public key format: #{e.message}"
|
|
128
|
-
)
|
|
66
|
+
def parse_timestamp(timestamp)
|
|
67
|
+
Integer(timestamp, 10)
|
|
68
|
+
rescue ArgumentError, TypeError
|
|
69
|
+
fail_verification("Invalid webhook timestamp: #{timestamp.inspect}")
|
|
129
70
|
end
|
|
130
71
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
137
|
-
message: "Invalid signature length: expected 64 bytes, got #{signature_bytes.bytesize} bytes"
|
|
72
|
+
def parse_public_key(public_key)
|
|
73
|
+
decoded_key = Base64.strict_decode64(public_key)
|
|
74
|
+
unless decoded_key.bytesize == 32
|
|
75
|
+
fail_verification(
|
|
76
|
+
"Invalid Ed25519 public key length: expected 32 bytes, got #{decoded_key.bytesize}"
|
|
138
77
|
)
|
|
139
78
|
end
|
|
140
|
-
rescue ArgumentError => e
|
|
141
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
142
|
-
message: "Invalid signature format: #{e.message}"
|
|
143
|
-
)
|
|
144
|
-
end
|
|
145
79
|
|
|
146
|
-
|
|
147
|
-
signed_payload = "#{timestamp_header}|#{payload}"
|
|
148
|
-
|
|
149
|
-
# Build ED25519 public key for verification
|
|
150
|
-
# The raw 32-byte key needs to be wrapped in X.509 SubjectPublicKeyInfo format
|
|
151
|
-
# ED25519 OID: 1.3.101.112 = 06 03 2b 65 70
|
|
152
|
-
# X.509 SPKI header for ED25519: 30 2a 30 05 06 03 2b 65 70 03 21 00
|
|
153
|
-
ed25519_spki_header = [
|
|
154
|
-
0x30,
|
|
155
|
-
0x2a,
|
|
156
|
-
0x30,
|
|
157
|
-
0x05,
|
|
158
|
-
0x06,
|
|
159
|
-
0x03,
|
|
160
|
-
0x2b,
|
|
161
|
-
0x65,
|
|
162
|
-
0x70,
|
|
163
|
-
0x03,
|
|
164
|
-
0x21,
|
|
165
|
-
0x00
|
|
166
|
-
].pack("C*")
|
|
167
|
-
der_key = ed25519_spki_header + public_key_bytes
|
|
168
|
-
|
|
169
|
-
begin
|
|
170
|
-
pkey = OpenSSL::PKey.read(der_key)
|
|
171
|
-
valid = pkey.verify(nil, signature_bytes, signed_payload)
|
|
172
|
-
|
|
173
|
-
unless valid
|
|
174
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
175
|
-
message: "Signature verification failed: signature does not match payload"
|
|
176
|
-
)
|
|
177
|
-
end
|
|
178
|
-
rescue OpenSSL::PKey::PKeyError => e
|
|
179
|
-
raise Telnyx::Errors::WebhookVerificationError.new(
|
|
180
|
-
message: "Signature verification failed: #{e.message}"
|
|
181
|
-
)
|
|
80
|
+
OpenSSL::PKey.read(ED25519_SPKI_PREFIX + decoded_key)
|
|
182
81
|
end
|
|
183
82
|
end
|
|
184
83
|
end
|
data/lib/telnyx/lib.rb
CHANGED
|
@@ -24,8 +24,9 @@ module Telnyx
|
|
|
24
24
|
Telnyx::Internal::Type::ArrayOf[Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]]
|
|
25
25
|
|
|
26
26
|
# @!attribute model
|
|
27
|
-
# The model to use for generating the response, for example
|
|
28
|
-
# another model available from the Telnyx models
|
|
27
|
+
# The model to use for generating the response, for example
|
|
28
|
+
# `zai-org/GLM-5.3-Flash` or another model available from the Telnyx models
|
|
29
|
+
# endpoint.
|
|
29
30
|
#
|
|
30
31
|
# @return [String]
|
|
31
32
|
required :model, String
|
|
@@ -150,7 +151,7 @@ module Telnyx
|
|
|
150
151
|
#
|
|
151
152
|
# @param messages [Array<Hash{Symbol=>Object}>] The messages to send to the model, following the [Anthropic Messages API](https:
|
|
152
153
|
#
|
|
153
|
-
# @param model [String] The model to use for generating the response, for example `zai-org/GLM-5.
|
|
154
|
+
# @param model [String] The model to use for generating the response, for example `zai-org/GLM-5.3-Flash
|
|
154
155
|
#
|
|
155
156
|
# @param api_key_ref [String] If you are using an external inference provider, this field allows you to pass a
|
|
156
157
|
#
|
|
@@ -263,6 +263,17 @@ module Telnyx
|
|
|
263
263
|
# @return [String, nil]
|
|
264
264
|
optional :description, String
|
|
265
265
|
|
|
266
|
+
# @!attribute diversion
|
|
267
|
+
# The number the inbound call was received on, forwarded so an unverified
|
|
268
|
+
# non-Telnyx `from` can be used as the caller id -- typically to transfer out as
|
|
269
|
+
# the original caller by pairing `from: "{{telnyx_end_user_target}}"` with
|
|
270
|
+
# `diversion: "{{telnyx_agent_target}}"`. The caller id is only accepted while
|
|
271
|
+
# that number is still on an active inbound call to this `diversion` number, and
|
|
272
|
+
# the `diversion` number must be one you own or have verified.
|
|
273
|
+
#
|
|
274
|
+
# @return [String, nil]
|
|
275
|
+
optional :diversion, String
|
|
276
|
+
|
|
266
277
|
# @!attribute voicemail_detection
|
|
267
278
|
# Configuration for voicemail detection (AMD - Answering Machine Detection) on the
|
|
268
279
|
# transferred call. Allows the assistant to detect when a voicemail system answers
|
|
@@ -280,6 +291,23 @@ module Telnyx
|
|
|
280
291
|
# @return [Integer, nil]
|
|
281
292
|
optional :warm_message_delay_ms, Integer, nil?: true
|
|
282
293
|
|
|
294
|
+
# @!attribute warm_transfer_acceptance
|
|
295
|
+
# Requires the transfer destination to accept the call before the caller is
|
|
296
|
+
# bridged. When enabled, the assistant speaks privately with the destination after
|
|
297
|
+
# they answer — delivering the warm transfer message and asking whether they take
|
|
298
|
+
# the call — while the caller keeps hearing ringback. The assistant then finalizes
|
|
299
|
+
# the transfer with the built-in `complete_transfer` tool: an accept bridges the
|
|
300
|
+
# calls, a decline hangs up the destination and returns the assistant to the
|
|
301
|
+
# caller with the reason the destination gave. Requires either
|
|
302
|
+
# `warm_transfer_instructions` or a `message` on every target, otherwise the
|
|
303
|
+
# assistant fails to save. Only available for calls started with
|
|
304
|
+
# `ai_assistant_start`; single-caller conversations only (a conference or
|
|
305
|
+
# additional invited participants fall back to a regular warm transfer).
|
|
306
|
+
#
|
|
307
|
+
# @return [Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance, nil]
|
|
308
|
+
optional :warm_transfer_acceptance,
|
|
309
|
+
-> { Telnyx::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance }
|
|
310
|
+
|
|
283
311
|
# @!attribute warm_transfer_instructions
|
|
284
312
|
# Natural language instructions for your agent for how to provide context for the
|
|
285
313
|
# transfer recipient.
|
|
@@ -287,7 +315,7 @@ module Telnyx
|
|
|
287
315
|
# @return [String, nil]
|
|
288
316
|
optional :warm_transfer_instructions, String
|
|
289
317
|
|
|
290
|
-
# @!method initialize(from:, targets:, custom_headers: nil, description: nil, voicemail_detection: nil, warm_message_delay_ms: nil, warm_transfer_instructions: nil)
|
|
318
|
+
# @!method initialize(from:, targets:, custom_headers: nil, description: nil, diversion: nil, voicemail_detection: nil, warm_message_delay_ms: nil, warm_transfer_acceptance: nil, warm_transfer_instructions: nil)
|
|
291
319
|
# Some parameter documentations has been truncated, see
|
|
292
320
|
# {Telnyx::Models::AI::AssistantTool::Transfer::Transfer} for more details.
|
|
293
321
|
#
|
|
@@ -299,10 +327,14 @@ module Telnyx
|
|
|
299
327
|
#
|
|
300
328
|
# @param description [String] A description of the transfer tool. By default, Telnyx generates this automatica
|
|
301
329
|
#
|
|
330
|
+
# @param diversion [String] The number the inbound call was received on, forwarded so an unverified non-Teln
|
|
331
|
+
#
|
|
302
332
|
# @param voicemail_detection [Telnyx::Models::AI::AssistantTool::Transfer::Transfer::VoicemailDetection] Configuration for voicemail detection (AMD - Answering Machine Detection) on the
|
|
303
333
|
#
|
|
304
334
|
# @param warm_message_delay_ms [Integer, nil] Optional delay in milliseconds before playing the warm message audio when the tr
|
|
305
335
|
#
|
|
336
|
+
# @param warm_transfer_acceptance [Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance] Requires the transfer destination to accept the call before the caller is bridge
|
|
337
|
+
#
|
|
306
338
|
# @param warm_transfer_instructions [String] Natural language instructions for your agent for how to provide context for the
|
|
307
339
|
|
|
308
340
|
# The different possible targets of the transfer. The assistant will be able to
|
|
@@ -326,15 +358,29 @@ module Telnyx
|
|
|
326
358
|
# @return [String]
|
|
327
359
|
required :to, String
|
|
328
360
|
|
|
361
|
+
# @!attribute message
|
|
362
|
+
# The warm transfer message to deliver to this specific target. When set, it takes
|
|
363
|
+
# precedence over the message the assistant composes from
|
|
364
|
+
# `warm_transfer_instructions`.
|
|
365
|
+
#
|
|
366
|
+
# @return [String, nil]
|
|
367
|
+
optional :message, String
|
|
368
|
+
|
|
329
369
|
# @!attribute name
|
|
330
370
|
# The name of the target.
|
|
331
371
|
#
|
|
332
372
|
# @return [String, nil]
|
|
333
373
|
optional :name, String
|
|
334
374
|
|
|
335
|
-
# @!method initialize(to:, name: nil)
|
|
375
|
+
# @!method initialize(to:, message: nil, name: nil)
|
|
376
|
+
# Some parameter documentations has been truncated, see
|
|
377
|
+
# {Telnyx::Models::AI::AssistantTool::Transfer::Transfer::Targets::TargetsList}
|
|
378
|
+
# for more details.
|
|
379
|
+
#
|
|
336
380
|
# @param to [String] The destination number or SIP URI of the call.
|
|
337
381
|
#
|
|
382
|
+
# @param message [String] The warm transfer message to deliver to this specific target. When set, it takes
|
|
383
|
+
#
|
|
338
384
|
# @param name [String] The name of the target.
|
|
339
385
|
end
|
|
340
386
|
|
|
@@ -615,6 +661,64 @@ module Telnyx
|
|
|
615
661
|
end
|
|
616
662
|
end
|
|
617
663
|
end
|
|
664
|
+
|
|
665
|
+
# @see Telnyx::Models::AI::AssistantTool::Transfer::Transfer#warm_transfer_acceptance
|
|
666
|
+
class WarmTransferAcceptance < Telnyx::Internal::Type::BaseModel
|
|
667
|
+
# @!attribute enabled
|
|
668
|
+
# Whether the destination must accept the transfer before the calls are bridged.
|
|
669
|
+
#
|
|
670
|
+
# @return [Boolean, nil]
|
|
671
|
+
optional :enabled, Telnyx::Internal::Type::Boolean
|
|
672
|
+
|
|
673
|
+
# @!attribute end_user_target_context_mode
|
|
674
|
+
# Controls whether the private exchange between the assistant and the transfer
|
|
675
|
+
# destination is kept out of the conversation. With `private` (default) the
|
|
676
|
+
# exchange never reaches the conversation history, AI conversations, webhooks or
|
|
677
|
+
# insights, and the transfer tool result is rewritten with the outcome only. With
|
|
678
|
+
# `shared` the exchange stays in the conversation like any other messages.
|
|
679
|
+
#
|
|
680
|
+
# @return [Symbol, Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance::EndUserTargetContextMode, nil]
|
|
681
|
+
optional :end_user_target_context_mode,
|
|
682
|
+
enum: -> { Telnyx::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance::EndUserTargetContextMode }
|
|
683
|
+
|
|
684
|
+
# @!method initialize(enabled: nil, end_user_target_context_mode: nil)
|
|
685
|
+
# Some parameter documentations has been truncated, see
|
|
686
|
+
# {Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance}
|
|
687
|
+
# for more details.
|
|
688
|
+
#
|
|
689
|
+
# Requires the transfer destination to accept the call before the caller is
|
|
690
|
+
# bridged. When enabled, the assistant speaks privately with the destination after
|
|
691
|
+
# they answer — delivering the warm transfer message and asking whether they take
|
|
692
|
+
# the call — while the caller keeps hearing ringback. The assistant then finalizes
|
|
693
|
+
# the transfer with the built-in `complete_transfer` tool: an accept bridges the
|
|
694
|
+
# calls, a decline hangs up the destination and returns the assistant to the
|
|
695
|
+
# caller with the reason the destination gave. Requires either
|
|
696
|
+
# `warm_transfer_instructions` or a `message` on every target, otherwise the
|
|
697
|
+
# assistant fails to save. Only available for calls started with
|
|
698
|
+
# `ai_assistant_start`; single-caller conversations only (a conference or
|
|
699
|
+
# additional invited participants fall back to a regular warm transfer).
|
|
700
|
+
#
|
|
701
|
+
# @param enabled [Boolean] Whether the destination must accept the transfer before the calls are bridged.
|
|
702
|
+
#
|
|
703
|
+
# @param end_user_target_context_mode [Symbol, Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance::EndUserTargetContextMode] Controls whether the private exchange between the assistant and the transfer des
|
|
704
|
+
|
|
705
|
+
# Controls whether the private exchange between the assistant and the transfer
|
|
706
|
+
# destination is kept out of the conversation. With `private` (default) the
|
|
707
|
+
# exchange never reaches the conversation history, AI conversations, webhooks or
|
|
708
|
+
# insights, and the transfer tool result is rewritten with the outcome only. With
|
|
709
|
+
# `shared` the exchange stays in the conversation like any other messages.
|
|
710
|
+
#
|
|
711
|
+
# @see Telnyx::Models::AI::AssistantTool::Transfer::Transfer::WarmTransferAcceptance#end_user_target_context_mode
|
|
712
|
+
module EndUserTargetContextMode
|
|
713
|
+
extend Telnyx::Internal::Type::Enum
|
|
714
|
+
|
|
715
|
+
PRIVATE = :private
|
|
716
|
+
SHARED = :shared
|
|
717
|
+
|
|
718
|
+
# @!method self.values
|
|
719
|
+
# @return [Array<Symbol>]
|
|
720
|
+
end
|
|
721
|
+
end
|
|
618
722
|
end
|
|
619
723
|
end
|
|
620
724
|
|
|
@@ -113,6 +113,16 @@ module Telnyx
|
|
|
113
113
|
# @return [Float, nil]
|
|
114
114
|
optional :presence_penalty, Float
|
|
115
115
|
|
|
116
|
+
# @!attribute reasoning_effort
|
|
117
|
+
# Controls the reasoning effort for models that support it. When set, the model
|
|
118
|
+
# spends more or less compute on internal reasoning before generating its
|
|
119
|
+
# response. Supported values: none, minimal, low, medium, high, xhigh, max. Not
|
|
120
|
+
# all models support all values; unsupported values are rejected with a 400 error.
|
|
121
|
+
# When omitted, reasoning models use their default effort level.
|
|
122
|
+
#
|
|
123
|
+
# @return [Symbol, Telnyx::Models::AI::ChatCompletionRequest::ReasoningEffort, nil]
|
|
124
|
+
optional :reasoning_effort, enum: -> { Telnyx::AI::ChatCompletionRequest::ReasoningEffort }
|
|
125
|
+
|
|
116
126
|
# @!attribute response_format
|
|
117
127
|
# Use this is you want to guarantee a JSON output without defining a schema. For
|
|
118
128
|
# control over the schema, use `guided_json`.
|
|
@@ -195,7 +205,7 @@ module Telnyx
|
|
|
195
205
|
# @return [Boolean, nil]
|
|
196
206
|
optional :use_beam_search, Telnyx::Internal::Type::Boolean
|
|
197
207
|
|
|
198
|
-
# @!method initialize(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, seed: nil, service_tier: nil, stop: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil)
|
|
208
|
+
# @!method initialize(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, reasoning_effort: nil, response_format: nil, seed: nil, service_tier: nil, stop: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil)
|
|
199
209
|
# Some parameter documentations has been truncated, see
|
|
200
210
|
# {Telnyx::Models::AI::ChatCompletionRequest} for more details.
|
|
201
211
|
#
|
|
@@ -231,6 +241,8 @@ module Telnyx
|
|
|
231
241
|
#
|
|
232
242
|
# @param presence_penalty [Float] Higher values will penalize the model from repeating the same output tokens.
|
|
233
243
|
#
|
|
244
|
+
# @param reasoning_effort [Symbol, Telnyx::Models::AI::ChatCompletionRequest::ReasoningEffort] Controls the reasoning effort for models that support it. When set, the model sp
|
|
245
|
+
#
|
|
234
246
|
# @param response_format [Telnyx::Models::AI::ChatCompletionRequest::ResponseFormat] Use this is you want to guarantee a JSON output without defining a schema. For c
|
|
235
247
|
#
|
|
236
248
|
# @param seed [Integer] If specified, the system will make a best effort to sample deterministically, su
|
|
@@ -333,6 +345,28 @@ module Telnyx
|
|
|
333
345
|
end
|
|
334
346
|
end
|
|
335
347
|
|
|
348
|
+
# Controls the reasoning effort for models that support it. When set, the model
|
|
349
|
+
# spends more or less compute on internal reasoning before generating its
|
|
350
|
+
# response. Supported values: none, minimal, low, medium, high, xhigh, max. Not
|
|
351
|
+
# all models support all values; unsupported values are rejected with a 400 error.
|
|
352
|
+
# When omitted, reasoning models use their default effort level.
|
|
353
|
+
#
|
|
354
|
+
# @see Telnyx::Models::AI::ChatCompletionRequest#reasoning_effort
|
|
355
|
+
module ReasoningEffort
|
|
356
|
+
extend Telnyx::Internal::Type::Enum
|
|
357
|
+
|
|
358
|
+
NONE = :none
|
|
359
|
+
MINIMAL = :minimal
|
|
360
|
+
LOW = :low
|
|
361
|
+
MEDIUM = :medium
|
|
362
|
+
HIGH = :high
|
|
363
|
+
XHIGH = :xhigh
|
|
364
|
+
MAX = :max
|
|
365
|
+
|
|
366
|
+
# @!method self.values
|
|
367
|
+
# @return [Array<Symbol>]
|
|
368
|
+
end
|
|
369
|
+
|
|
336
370
|
# @see Telnyx::Models::AI::ChatCompletionRequest#response_format
|
|
337
371
|
class ResponseFormat < Telnyx::Internal::Type::BaseModel
|
|
338
372
|
# @!attribute type
|
|
@@ -8,6 +8,9 @@ module Telnyx
|
|
|
8
8
|
# @!attribute retrieval_type
|
|
9
9
|
# Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines
|
|
10
10
|
# vector similarity with keyword matching; `keyword` runs lexical (BM25) matching.
|
|
11
|
+
# `keyword` is not accepted yet: setting it returns 422
|
|
12
|
+
# `unsupported_retrieval_type`. A collection set to `hybrid` is accepted here but
|
|
13
|
+
# cannot be searched until hybrid execution ships.
|
|
11
14
|
#
|
|
12
15
|
# @return [Symbol, Telnyx::Models::AI::Collections::RetrievalSettings::RetrievalType, nil]
|
|
13
16
|
optional :retrieval_type, enum: -> { Telnyx::AI::Collections::RetrievalSettings::RetrievalType }
|
|
@@ -30,6 +33,9 @@ module Telnyx
|
|
|
30
33
|
|
|
31
34
|
# Retrieval strategy. `vector` runs semantic similarity search; `hybrid` combines
|
|
32
35
|
# vector similarity with keyword matching; `keyword` runs lexical (BM25) matching.
|
|
36
|
+
# `keyword` is not accepted yet: setting it returns 422
|
|
37
|
+
# `unsupported_retrieval_type`. A collection set to `hybrid` is accepted here but
|
|
38
|
+
# cannot be searched until hybrid execution ships.
|
|
33
39
|
#
|
|
34
40
|
# @see Telnyx::Models::AI::Collections::RetrievalSettings#retrieval_type
|
|
35
41
|
module RetrievalType
|
|
@@ -37,7 +43,6 @@ module Telnyx
|
|
|
37
43
|
|
|
38
44
|
VECTOR = :vector
|
|
39
45
|
HYBRID = :hybrid
|
|
40
|
-
KEYWORD = :keyword
|
|
41
46
|
|
|
42
47
|
# @!method self.values
|
|
43
48
|
# @return [Array<Symbol>]
|
|
@@ -111,6 +111,31 @@ module Telnyx
|
|
|
111
111
|
# @return [Telnyx::Models::AI::InferenceEmbeddingWebhookToolParams::Webhook::PathParameters, nil]
|
|
112
112
|
optional :path_parameters, -> { Telnyx::AI::InferenceEmbeddingWebhookToolParams::Webhook::PathParameters }
|
|
113
113
|
|
|
114
|
+
# @!attribute preset_body_fields
|
|
115
|
+
# Body fields supplied by the assistant configuration rather than by the model.
|
|
116
|
+
# They are never advertised in the tool definition, so the LLM can neither see nor
|
|
117
|
+
# set them, and they take precedence over a `body_parameters` value of the same
|
|
118
|
+
# name. Values support mustache templating, so they can hold dynamic variables
|
|
119
|
+
# (`{{customer_id}}`) and integration secrets
|
|
120
|
+
# (`{{#integration_secret}}my-secret{{/integration_secret}}`). Not sent on `GET`
|
|
121
|
+
# requests, which carry no body.
|
|
122
|
+
#
|
|
123
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
124
|
+
optional :preset_body_fields, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]
|
|
125
|
+
|
|
126
|
+
# @!attribute preset_query_params
|
|
127
|
+
# Query string parameters supplied by the assistant configuration rather than by
|
|
128
|
+
# the model. They are never advertised in the tool definition, so the LLM can
|
|
129
|
+
# neither see nor set them, and they take precedence over a `query_parameters`
|
|
130
|
+
# value of the same name. Values support mustache templating, so they can hold
|
|
131
|
+
# dynamic variables (`{{telnyx_end_user_target}}`) and integration secrets
|
|
132
|
+
# (`{{#integration_secret}}my-secret{{/integration_secret}}`). Unlike values
|
|
133
|
+
# templated directly into the `url`, these are percent-encoded, so a value such as
|
|
134
|
+
# `+15551234567` survives the round trip.
|
|
135
|
+
#
|
|
136
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
137
|
+
optional :preset_query_params, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]
|
|
138
|
+
|
|
114
139
|
# @!attribute query_parameters
|
|
115
140
|
# The query parameters the webhook tool accepts, described as a JSON Schema
|
|
116
141
|
# object. These parameters will be passed to the webhook as the query of the
|
|
@@ -138,7 +163,7 @@ module Telnyx
|
|
|
138
163
|
# @return [Integer, nil]
|
|
139
164
|
optional :timeout_ms, Integer
|
|
140
165
|
|
|
141
|
-
# @!method initialize(description:, name:, url:, async: nil, async_timeout_ms: nil, body_parameters: nil, headers: nil, messages: nil, http_method: nil, path_parameters: nil, query_parameters: nil, store_fields_as_variables: nil, timeout_ms: nil)
|
|
166
|
+
# @!method initialize(description:, name:, url:, async: nil, async_timeout_ms: nil, body_parameters: nil, headers: nil, messages: nil, http_method: nil, path_parameters: nil, preset_body_fields: nil, preset_query_params: nil, query_parameters: nil, store_fields_as_variables: nil, timeout_ms: nil)
|
|
142
167
|
# Some parameter documentations has been truncated, see
|
|
143
168
|
# {Telnyx::Models::AI::InferenceEmbeddingWebhookToolParams::Webhook} for more
|
|
144
169
|
# details.
|
|
@@ -163,6 +188,10 @@ module Telnyx
|
|
|
163
188
|
#
|
|
164
189
|
# @param path_parameters [Telnyx::Models::AI::InferenceEmbeddingWebhookToolParams::Webhook::PathParameters] The path parameters the webhook tool accepts, described as a JSON Schema object.
|
|
165
190
|
#
|
|
191
|
+
# @param preset_body_fields [Hash{Symbol=>Object}] Body fields supplied by the assistant configuration rather than by the model. Th
|
|
192
|
+
#
|
|
193
|
+
# @param preset_query_params [Hash{Symbol=>Object}] Query string parameters supplied by the assistant configuration rather than by t
|
|
194
|
+
#
|
|
166
195
|
# @param query_parameters [Telnyx::Models::AI::InferenceEmbeddingWebhookToolParams::Webhook::QueryParameters] The query parameters the webhook tool accepts, described as a JSON Schema object
|
|
167
196
|
#
|
|
168
197
|
# @param store_fields_as_variables [Array<Telnyx::Models::AI::InferenceEmbeddingWebhookToolParams::Webhook::StoreFieldsAsVariable>] A list of mappings that extract values from the webhook response and store them
|