Class: Telnyx::Resources::AI::Conversations::Messages

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/conversations/messages.rb

Overview

Manage historical AI assistant conversations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Messages

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

Parameters:



41
42
43
# File 'lib/telnyx/resources/ai/conversations/messages.rb', line 41

def initialize(client:)
  @client = client
end

Instance Method Details

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

Retrieve messages for a specific conversation, including tool calls made by the assistant.

Parameters:

  • conversation_id (String)
  • page_number (Integer)

    The page number to retrieve.

  • page_size (Integer)

    The number of messages to return per page.

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/telnyx/resources/ai/conversations/messages.rb', line 25

def list(conversation_id, params = {})
  parsed, options = Telnyx::AI::Conversations::MessageListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["ai/conversations/%1$s/messages", conversation_id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::AI::Conversations::MessageListResponse,
    options: options
  )
end