Class: Telnyx::Resources::AI::Conversations
- Inherits:
-
Object
- Object
- Telnyx::Resources::AI::Conversations
- Defined in:
- lib/telnyx/resources/ai/conversations.rb,
lib/telnyx/resources/ai/conversations/insights.rb,
lib/telnyx/resources/ai/conversations/messages.rb,
lib/telnyx/resources/ai/conversations/insight_groups.rb,
lib/telnyx/resources/ai/conversations/insight_groups/insights.rb
Overview
Manage historical AI assistant conversations
Defined Under Namespace
Classes: InsightGroups, Insights, Messages
Instance Attribute Summary collapse
-
#insight_groups ⇒ Telnyx::Resources::AI::Conversations::InsightGroups
readonly
Manage historical AI assistant conversations.
-
#insights ⇒ Telnyx::Resources::AI::Conversations::Insights
readonly
Manage historical AI assistant conversations.
-
#messages ⇒ Telnyx::Resources::AI::Conversations::Messages
readonly
Manage historical AI assistant conversations.
Instance Method Summary collapse
-
#add_message(conversation_id, role:, content: nil, metadata: nil, name: nil, sent_at: nil, tool_call_id: nil, tool_calls: nil, tool_choice: nil, request_options: {}) ⇒ nil
Add a new message to the conversation.
-
#create(metadata: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::Conversation
Some parameter documentations has been truncated, see Models::AI::ConversationCreateParams for more details.
-
#delete(conversation_id, request_options: {}) ⇒ nil
Delete a specific conversation by its ID.
-
#initialize(client:) ⇒ Conversations
constructor
private
A new instance of Conversations.
-
#list(id: nil, created_at: nil, last_message_at: nil, limit: nil, metadata_assistant_id: nil, metadata_call_control_id: nil, metadata_telnyx_agent_target: nil, metadata_telnyx_conversation_channel: nil, metadata_telnyx_end_user_target: nil, name: nil, or_: nil, order: nil, request_options: {}) ⇒ Telnyx::Models::AI::ConversationListResponse
Some parameter documentations has been truncated, see Models::AI::ConversationListParams for more details.
-
#retrieve(conversation_id, request_options: {}) ⇒ Telnyx::Models::AI::ConversationRetrieveResponse
Retrieve a specific AI conversation by its ID.
-
#retrieve_conversations_insights(conversation_id, request_options: {}) ⇒ Telnyx::Models::AI::ConversationRetrieveConversationsInsightsResponse
Retrieve insights for a specific conversation.
-
#update(conversation_id, metadata: nil, request_options: {}) ⇒ Telnyx::Models::AI::ConversationUpdateResponse
Some parameter documentations has been truncated, see Models::AI::ConversationUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Conversations
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 Conversations.
234 235 236 237 238 239 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 234 def initialize(client:) @client = client @insight_groups = Telnyx::Resources::AI::Conversations::InsightGroups.new(client: client) @insights = Telnyx::Resources::AI::Conversations::Insights.new(client: client) @messages = Telnyx::Resources::AI::Conversations::Messages.new(client: client) end |
Instance Attribute Details
#insight_groups ⇒ Telnyx::Resources::AI::Conversations::InsightGroups (readonly)
Manage historical AI assistant conversations
10 11 12 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 10 def insight_groups @insight_groups end |
#insights ⇒ Telnyx::Resources::AI::Conversations::Insights (readonly)
Manage historical AI assistant conversations
14 15 16 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 14 def insights @insights end |
#messages ⇒ Telnyx::Resources::AI::Conversations::Messages (readonly)
Manage historical AI assistant conversations
18 19 20 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 18 def @messages end |
Instance Method Details
#add_message(conversation_id, role:, content: nil, metadata: nil, name: nil, sent_at: nil, tool_call_id: nil, tool_calls: nil, tool_choice: nil, request_options: {}) ⇒ nil
Add a new message to the conversation. Used to insert a new messages to a conversation manually ( without using chat endpoint )
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 201 def (conversation_id, params) parsed, = Telnyx::AI::ConversationAddMessageParams.dump_request(params) @client.request( method: :post, path: ["ai/conversations/%1$s/message", conversation_id], body: parsed, model: NilClass, options: ) end |
#create(metadata: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::Conversation
Some parameter documentations has been truncated, see Models::AI::ConversationCreateParams for more details.
Create a new AI Conversation.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 36 def create(params = {}) parsed, = Telnyx::AI::ConversationCreateParams.dump_request(params) @client.request( method: :post, path: "ai/conversations", body: parsed, model: Telnyx::AI::Conversation, options: ) end |
#delete(conversation_id, request_options: {}) ⇒ nil
Delete a specific conversation by its ID.
164 165 166 167 168 169 170 171 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 164 def delete(conversation_id, params = {}) @client.request( method: :delete, path: ["ai/conversations/%1$s", conversation_id], model: NilClass, options: params[:request_options] ) end |
#list(id: nil, created_at: nil, last_message_at: nil, limit: nil, metadata_assistant_id: nil, metadata_call_control_id: nil, metadata_telnyx_agent_target: nil, metadata_telnyx_conversation_channel: nil, metadata_telnyx_end_user_target: nil, name: nil, or_: nil, order: nil, request_options: {}) ⇒ Telnyx::Models::AI::ConversationListResponse
Some parameter documentations has been truncated, see Models::AI::ConversationListParams for more details.
Retrieve a list of all AI conversations configured by the user. Supports [PostgREST-style query parameters](postgrest.org/en/stable/api.html#horizontal-filtering-rows) for filtering. Examples are included for the standard metadata fields, but you can filter on any field in the metadata JSON object. For example, to filter by a custom field ‘metadata->custom_field`, use `metadata->custom_field=eq.value`.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 134 def list(params = {}) parsed, = Telnyx::AI::ConversationListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "ai/conversations", query: query.transform_keys( metadata_assistant_id: "metadata->assistant_id", metadata_call_control_id: "metadata->call_control_id", metadata_telnyx_agent_target: "metadata->telnyx_agent_target", metadata_telnyx_conversation_channel: "metadata->telnyx_conversation_channel", metadata_telnyx_end_user_target: "metadata->telnyx_end_user_target", or_: "or" ), model: Telnyx::Models::AI::ConversationListResponse, options: ) end |
#retrieve(conversation_id, request_options: {}) ⇒ Telnyx::Models::AI::ConversationRetrieveResponse
Retrieve a specific AI conversation by its ID.
58 59 60 61 62 63 64 65 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 58 def retrieve(conversation_id, params = {}) @client.request( method: :get, path: ["ai/conversations/%1$s", conversation_id], model: Telnyx::Models::AI::ConversationRetrieveResponse, options: params[:request_options] ) end |
#retrieve_conversations_insights(conversation_id, request_options: {}) ⇒ Telnyx::Models::AI::ConversationRetrieveConversationsInsightsResponse
Retrieve insights for a specific conversation
222 223 224 225 226 227 228 229 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 222 def retrieve_conversations_insights(conversation_id, params = {}) @client.request( method: :get, path: ["ai/conversations/%1$s/conversations-insights", conversation_id], model: Telnyx::Models::AI::ConversationRetrieveConversationsInsightsResponse, options: params[:request_options] ) end |
#update(conversation_id, metadata: nil, request_options: {}) ⇒ Telnyx::Models::AI::ConversationUpdateResponse
Some parameter documentations has been truncated, see Models::AI::ConversationUpdateParams for more details.
Update metadata for a specific conversation.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 83 def update(conversation_id, params = {}) parsed, = Telnyx::AI::ConversationUpdateParams.dump_request(params) @client.request( method: :put, path: ["ai/conversations/%1$s", conversation_id], body: parsed, model: Telnyx::Models::AI::ConversationUpdateResponse, options: ) end |