Class: OpenAI::Resources::Beta::ChatKit::Threads

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/beta/chatkit/threads.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Threads

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

Parameters:

API:

  • private



121
122
123
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(thread_id, request_options: {}) ⇒ OpenAI::Models::Beta::ChatKit::ThreadDeleteResponse

Delete a ChatKit thread along with its items and stored attachments.

Parameters:

  • Identifier of the ChatKit thread to delete.

Returns:

See Also:



74
75
76
77
78
79
80
81
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 74

def delete(thread_id, params = {})
  @client.request(
    method: :delete,
    path: ["chatkit/threads/%1$s", thread_id],
    model: OpenAI::Models::Beta::ChatKit::ThreadDeleteResponse,
    options: {extra_headers: {"OpenAI-Beta" => "chatkit_beta=v1"}, **params[:request_options].to_h}
  )
end

#list(after: nil, before: nil, limit: nil, order: nil, user: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Beta::ChatKit::ChatKitThread>

Some parameter documentations has been truncated, see Models::Beta::ChatKit::ThreadListParams for more details.

List ChatKit threads with optional pagination and user filters.

Parameters:

  • List items created after this thread item ID. Defaults to null for the first pag

  • List items created before this thread item ID. Defaults to null for the newest r

  • Maximum number of thread items to return. Defaults to 20.

  • Sort order for results by creation time. Defaults to desc.

  • Filter threads that belong to this user identifier. Defaults to null to return a

Returns:

See Also:



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 50

def list(params = {})
  parsed, options = OpenAI::Beta::ChatKit::ThreadListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "chatkit/threads",
    query: query,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Beta::ChatKit::ChatKitThread,
    options: {extra_headers: {"OpenAI-Beta" => "chatkit_beta=v1"}, **options}
  )
end

#list_items(thread_id, after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Beta::ChatKit::ChatKitThreadUserMessageItem, OpenAI::Models::Beta::ChatKit::ChatKitThreadAssistantMessageItem, OpenAI::Models::Beta::ChatKit::ChatKitWidgetItem, OpenAI::Models::Beta::ChatKit::ChatKitThreadItemList::Data::ChatKitClientToolCall, OpenAI::Models::Beta::ChatKit::ChatKitThreadItemList::Data::ChatKitTask, OpenAI::Models::Beta::ChatKit::ChatKitThreadItemList::Data::ChatKitTaskGroup>

Some parameter documentations has been truncated, see Models::Beta::ChatKit::ThreadListItemsParams for more details.

List items that belong to a ChatKit thread.

Parameters:

  • Identifier of the ChatKit thread whose items are requested.

  • List items created after this thread item ID. Defaults to null for the first pag

  • List items created before this thread item ID. Defaults to null for the newest r

  • Maximum number of thread items to return. Defaults to 20.

  • Sort order for results by creation time. Defaults to desc.

Returns:

See Also:



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 105

def list_items(thread_id, params = {})
  parsed, options = OpenAI::Beta::ChatKit::ThreadListItemsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["chatkit/threads/%1$s/items", thread_id],
    query: query,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Beta::ChatKit::ChatKitThreadItemList::Data,
    options: {extra_headers: {"OpenAI-Beta" => "chatkit_beta=v1"}, **options}
  )
end

#retrieve(thread_id, request_options: {}) ⇒ OpenAI::Models::Beta::ChatKit::ChatKitThread

Retrieve a ChatKit thread by its identifier.

Parameters:

  • Identifier of the ChatKit thread to retrieve.

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 19

def retrieve(thread_id, params = {})
  @client.request(
    method: :get,
    path: ["chatkit/threads/%1$s", thread_id],
    model: OpenAI::Beta::ChatKit::ChatKitThread,
    options: {extra_headers: {"OpenAI-Beta" => "chatkit_beta=v1"}, **params[:request_options].to_h}
  )
end