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
Defined Under Namespace
Classes: InsightGroups, Insights, Messages
Instance Attribute Summary collapse
- #insight_groups ⇒ Telnyx::Resources::AI::Conversations::InsightGroups readonly
- #insights ⇒ Telnyx::Resources::AI::Conversations::Insights readonly
- #messages ⇒ Telnyx::Resources::AI::Conversations::Messages readonly
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
Create a new AI Conversation.
-
#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
Update metadata for a specific conversation.
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.
223 224 225 226 227 228 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 223 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)
8 9 10 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 8 def insight_groups @insight_groups end |
#insights ⇒ Telnyx::Resources::AI::Conversations::Insights (readonly)
11 12 13 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 11 def insights @insights end |
#messages ⇒ Telnyx::Resources::AI::Conversations::Messages (readonly)
14 15 16 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 14 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 )
190 191 192 193 194 195 196 197 198 199 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 190 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
Create a new AI Conversation.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 29 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.
153 154 155 156 157 158 159 160 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 153 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`.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 124 def list(params = {}) parsed, = Telnyx::AI::ConversationListParams.dump_request(params) @client.request( method: :get, path: "ai/conversations", query: parsed.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.
51 52 53 54 55 56 57 58 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 51 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
211 212 213 214 215 216 217 218 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 211 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
Update metadata for a specific conversation.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/telnyx/resources/ai/conversations.rb', line 73 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 |