Class: Telnyx::Resources::AI::Conversations::InsightGroups

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/conversations/insight_groups.rb,
lib/telnyx/resources/ai/conversations/insight_groups/insights.rb,
sig/telnyx/resources/ai/conversations/insight_groups.rbs,
sig/telnyx/resources/ai/conversations/insight_groups/insights.rbs

Overview

Manage historical AI assistant conversations

Defined Under Namespace

Classes: Insights

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ InsightGroups

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 InsightGroups.

Parameters:



146
147
148
149
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 146

def initialize(client:)
  @client = client
  @insights = Telnyx::Resources::AI::Conversations::InsightGroups::Insights.new(client: client)
end

Instance Attribute Details

#insightsTelnyx::Resources::AI::Conversations::InsightGroups::Insights (readonly)

Manage historical AI assistant conversations



11
12
13
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 11

def insights
  @insights
end

Instance Method Details

#delete(group_id, request_options: {}) ⇒ nil

Permanently deletes the specified insight template group by its ID.

Parameters:

  • group_id (String)

    The ID of the insight group

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 73

def delete(group_id, params = {})
  @client.request(
    method: :delete,
    path: ["ai/conversations/insight-groups/%1$s", group_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#insight_groups(name:, description: nil, webhook: nil, idempotency_key: nil, request_options: {}) ⇒ Telnyx::Models::AI::Conversations::InsightTemplateGroupDetail

Some parameter documentations has been truncated, see Models::AI::Conversations::InsightGroupInsightGroupsParams for more details.

Creates a new insight template group for organizing related insight templates, and returns the created group.

Parameters:

  • name (String)

    Body param

  • description (String)

    Body param

  • webhook (String)

    Body param

  • idempotency_key (String)

    Header param: Optional opaque, unquoted key for safely retrying the same logical

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 104

def insight_groups(params)
  parsed, options = Telnyx::AI::Conversations::InsightGroupInsightGroupsParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: "ai/conversations/insight-groups",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Telnyx::AI::Conversations::InsightTemplateGroupDetail,
    options: options
  )
end

#retrieve(group_id, request_options: {}) ⇒ Telnyx::Models::AI::Conversations::InsightTemplateGroupDetail

Returns the details of a single insight template group, including the insight templates assigned to it.

Parameters:

  • group_id (String)

    The ID of the insight group

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 25

def retrieve(group_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/conversations/insight-groups/%1$s", group_id],
    model: Telnyx::AI::Conversations::InsightTemplateGroupDetail,
    options: params[:request_options]
  )
end

#retrieve_insight_groups(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Conversations::InsightTemplateGroup>

Returns a paginated list of your insight template groups. Groups organize related insight templates that are applied together when analyzing conversations.

Parameters:

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 130

def retrieve_insight_groups(params = {})
  parsed, options = Telnyx::AI::Conversations::InsightGroupRetrieveInsightGroupsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "ai/conversations/insight-groups",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::AI::Conversations::InsightTemplateGroup,
    options: options
  )
end

#update(group_id, description: nil, name: nil, webhook: nil, request_options: {}) ⇒ Telnyx::Models::AI::Conversations::InsightTemplateGroupDetail

Updates the specified insight template group and returns the updated group.

Parameters:

  • group_id (String)

    The ID of the insight group

  • description (String)
  • name (String)
  • webhook (String)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
# File 'lib/telnyx/resources/ai/conversations/insight_groups.rb', line 51

def update(group_id, params = {})
  parsed, options = Telnyx::AI::Conversations::InsightGroupUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["ai/conversations/insight-groups/%1$s", group_id],
    body: parsed,
    model: Telnyx::AI::Conversations::InsightTemplateGroupDetail,
    options: options
  )
end