Class: Telnyx::Resources::AI::Assistants
- Inherits:
-
Object
- Object
- Telnyx::Resources::AI::Assistants
- Defined in:
- lib/telnyx/resources/ai/assistants.rb,
lib/telnyx/resources/ai/assistants/tests.rb,
lib/telnyx/resources/ai/assistants/tools.rb,
lib/telnyx/resources/ai/assistants/versions.rb,
lib/telnyx/resources/ai/assistants/tests/runs.rb,
lib/telnyx/resources/ai/assistants/canary_deploys.rb,
lib/telnyx/resources/ai/assistants/scheduled_events.rb,
lib/telnyx/resources/ai/assistants/tests/test_suites.rb,
lib/telnyx/resources/ai/assistants/tests/test_suites/runs.rb
Defined Under Namespace
Classes: CanaryDeploys, ScheduledEvents, Tests, Tools, Versions
Instance Attribute Summary collapse
- #canary_deploys ⇒ Telnyx::Resources::AI::Assistants::CanaryDeploys readonly
- #scheduled_events ⇒ Telnyx::Resources::AI::Assistants::ScheduledEvents readonly
- #tests ⇒ Telnyx::Resources::AI::Assistants::Tests readonly
- #tools ⇒ Telnyx::Resources::AI::Assistants::Tools readonly
- #versions ⇒ Telnyx::Resources::AI::Assistants::Versions readonly
Instance Method Summary collapse
-
#chat(assistant_id, content:, conversation_id:, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantChatResponse
This endpoint allows a client to send a chat message to a specific AI Assistant.
-
#clone_(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Clone an existing assistant, excluding telephony and messaging settings.
-
#create(instructions:, model:, name:, description: nil, dynamic_variables: nil, dynamic_variables_webhook_url: nil, enabled_features: nil, greeting: nil, insight_settings: nil, llm_api_key_ref: nil, messaging_settings: nil, privacy_settings: nil, telephony_settings: nil, tools: nil, transcription: nil, voice_settings: nil, widget_settings: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Some parameter documentations has been truncated, see Models::AI::AssistantCreateParams for more details.
-
#delete(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::AssistantDeleteResponse
Delete an AI Assistant by ‘assistant_id`.
-
#get_texml(assistant_id, request_options: {}) ⇒ String
Get an assistant texml by ‘assistant_id`.
-
#imports(api_key_ref:, provider:, import_ids: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantsList
Some parameter documentations has been truncated, see Models::AI::AssistantImportsParams for more details.
-
#initialize(client:) ⇒ Assistants
constructor
private
A new instance of Assistants.
-
#list(request_options: {}) ⇒ Telnyx::Models::AI::AssistantsList
Retrieve a list of all AI Assistants configured by the user.
-
#retrieve(assistant_id, call_control_id: nil, fetch_dynamic_variables_from_webhook: nil, from: nil, to: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Retrieve an AI Assistant configuration by ‘assistant_id`.
-
#send_sms(assistant_id, from:, to:, conversation_metadata: nil, should_create_conversation: nil, text: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantSendSMSResponse
Send an SMS message for an assistant.
-
#update(assistant_id, description: nil, dynamic_variables: nil, dynamic_variables_webhook_url: nil, enabled_features: nil, greeting: nil, insight_settings: nil, instructions: nil, llm_api_key_ref: nil, messaging_settings: nil, model: nil, name: nil, privacy_settings: nil, promote_to_main: nil, telephony_settings: nil, tools: nil, transcription: nil, voice_settings: nil, widget_settings: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Some parameter documentations has been truncated, see Models::AI::AssistantUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Assistants
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Assistants.
345 346 347 348 349 350 351 352 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 345 def initialize(client:) @client = client @tests = Telnyx::Resources::AI::Assistants::Tests.new(client: client) @canary_deploys = Telnyx::Resources::AI::Assistants::CanaryDeploys.new(client: client) @scheduled_events = Telnyx::Resources::AI::Assistants::ScheduledEvents.new(client: client) @tools = Telnyx::Resources::AI::Assistants::Tools.new(client: client) @versions = Telnyx::Resources::AI::Assistants::Versions.new(client: client) end |
Instance Attribute Details
#canary_deploys ⇒ Telnyx::Resources::AI::Assistants::CanaryDeploys (readonly)
11 12 13 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 11 def canary_deploys @canary_deploys end |
#scheduled_events ⇒ Telnyx::Resources::AI::Assistants::ScheduledEvents (readonly)
14 15 16 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 14 def scheduled_events @scheduled_events end |
#tests ⇒ Telnyx::Resources::AI::Assistants::Tests (readonly)
8 9 10 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 8 def tests @tests end |
#tools ⇒ Telnyx::Resources::AI::Assistants::Tools (readonly)
17 18 19 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 17 def tools @tools end |
#versions ⇒ Telnyx::Resources::AI::Assistants::Versions (readonly)
20 21 22 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 20 def versions @versions end |
Instance Method Details
#chat(assistant_id, content:, conversation_id:, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantChatResponse
This endpoint allows a client to send a chat message to a specific AI Assistant. The assistant processes the message and returns a relevant reply based on the current conversation context. Refer to the Conversation API to [create a conversation](developers.telnyx.com/api-reference/conversations/create-a-conversation), [filter existing conversations](developers.telnyx.com/api-reference/conversations/list-conversations), [fetch messages for a conversation](developers.telnyx.com/api-reference/conversations/get-conversation-messages), and [manually add messages to a conversation](developers.telnyx.com/api-reference/conversations/create-message).
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 226 def chat(assistant_id, params) parsed, = Telnyx::AI::AssistantChatParams.dump_request(params) @client.request( method: :post, path: ["ai/assistants/%1$s/chat", assistant_id], body: parsed, model: Telnyx::Models::AI::AssistantChatResponse, options: ) end |
#clone_(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Clone an existing assistant, excluding telephony and messaging settings.
247 248 249 250 251 252 253 254 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 247 def clone_(assistant_id, params = {}) @client.request( method: :post, path: ["ai/assistants/%1$s/clone", assistant_id], model: Telnyx::AI::InferenceEmbedding, options: params[:request_options] ) end |
#create(instructions:, model:, name:, description: nil, dynamic_variables: nil, dynamic_variables_webhook_url: nil, enabled_features: nil, greeting: nil, insight_settings: nil, llm_api_key_ref: nil, messaging_settings: nil, privacy_settings: nil, telephony_settings: nil, tools: nil, transcription: nil, voice_settings: nil, widget_settings: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Some parameter documentations has been truncated, see Models::AI::AssistantCreateParams for more details.
Create a new AI Assistant.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 68 def create(params) parsed, = Telnyx::AI::AssistantCreateParams.dump_request(params) @client.request( method: :post, path: "ai/assistants", body: parsed, model: Telnyx::AI::InferenceEmbedding, options: ) end |
#delete(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::AssistantDeleteResponse
Delete an AI Assistant by ‘assistant_id`.
193 194 195 196 197 198 199 200 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 193 def delete(assistant_id, params = {}) @client.request( method: :delete, path: ["ai/assistants/%1$s", assistant_id], model: Telnyx::Models::AI::AssistantDeleteResponse, options: params[:request_options] ) end |
#get_texml(assistant_id, request_options: {}) ⇒ String
Get an assistant texml by ‘assistant_id`.
266 267 268 269 270 271 272 273 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 266 def get_texml(assistant_id, params = {}) @client.request( method: :get, path: ["ai/assistants/%1$s/texml", assistant_id], model: String, options: params[:request_options] ) end |
#imports(api_key_ref:, provider:, import_ids: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantsList
Some parameter documentations has been truncated, see Models::AI::AssistantImportsParams for more details.
Import assistants from external providers. Any assistant that has already been imported will be overwritten with its latest version from the importing provider.
295 296 297 298 299 300 301 302 303 304 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 295 def imports(params) parsed, = Telnyx::AI::AssistantImportsParams.dump_request(params) @client.request( method: :post, path: "ai/assistants/import", body: parsed, model: Telnyx::AI::AssistantsList, options: ) end |
#list(request_options: {}) ⇒ Telnyx::Models::AI::AssistantsList
Retrieve a list of all AI Assistants configured by the user.
174 175 176 177 178 179 180 181 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 174 def list(params = {}) @client.request( method: :get, path: "ai/assistants", model: Telnyx::AI::AssistantsList, options: params[:request_options] ) end |
#retrieve(assistant_id, call_control_id: nil, fetch_dynamic_variables_from_webhook: nil, from: nil, to: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Retrieve an AI Assistant configuration by ‘assistant_id`.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 93 def retrieve(assistant_id, params = {}) parsed, = Telnyx::AI::AssistantRetrieveParams.dump_request(params) @client.request( method: :get, path: ["ai/assistants/%1$s", assistant_id], query: parsed, model: Telnyx::AI::InferenceEmbedding, options: ) end |
#send_sms(assistant_id, from:, to:, conversation_metadata: nil, should_create_conversation: nil, text: nil, request_options: {}) ⇒ Telnyx::Models::AI::AssistantSendSMSResponse
Send an SMS message for an assistant. This endpoint:
-
Validates the assistant exists and has messaging profile configured
-
If should_create_conversation is true, creates a new conversation with metadata
-
Sends the SMS message (If ‘text` is set, this will be sent. Otherwise, if this is the first message in the conversation and the assistant has a `greeting` configured, this will be sent. Otherwise the assistant will generate the text to send.)
-
Updates conversation metadata if provided
-
Returns the conversation ID
331 332 333 334 335 336 337 338 339 340 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 331 def send_sms(assistant_id, params) parsed, = Telnyx::AI::AssistantSendSMSParams.dump_request(params) @client.request( method: :post, path: ["ai/assistants/%1$s/chat/sms", assistant_id], body: parsed, model: Telnyx::Models::AI::AssistantSendSMSResponse, options: ) end |
#update(assistant_id, description: nil, dynamic_variables: nil, dynamic_variables_webhook_url: nil, enabled_features: nil, greeting: nil, insight_settings: nil, instructions: nil, llm_api_key_ref: nil, messaging_settings: nil, model: nil, name: nil, privacy_settings: nil, promote_to_main: nil, telephony_settings: nil, tools: nil, transcription: nil, voice_settings: nil, widget_settings: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding
Some parameter documentations has been truncated, see Models::AI::AssistantUpdateParams for more details.
Update an AI Assistant’s attributes.
154 155 156 157 158 159 160 161 162 163 |
# File 'lib/telnyx/resources/ai/assistants.rb', line 154 def update(assistant_id, params = {}) parsed, = Telnyx::AI::AssistantUpdateParams.dump_request(params) @client.request( method: :post, path: ["ai/assistants/%1$s", assistant_id], body: parsed, model: Telnyx::AI::InferenceEmbedding, options: ) end |