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:



119
120
121
# File 'lib/openai/resources/beta/chatkit/threads.rb', line 119

def initialize(client:)
  @client = client
end

Instance Method Details

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

Delete a ChatKit thread

Parameters:

  • thread_id (String)

    Identifier of the ChatKit thread to delete.

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

Returns:

See Also:



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

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

Parameters:

  • after (String)

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

  • before (String)

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

  • limit (Integer)

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

  • order (Symbol, OpenAI::Models::Beta::ChatKit::ThreadListParams::Order)

    Sort order for results by creation time. Defaults to ‘desc`.

  • user (String)

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

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

Returns:

See Also:



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

def list(params = {})
  parsed, options = OpenAI::Beta::ChatKit::ThreadListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "chatkit/threads",
    query: parsed,
    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 ChatKit thread items

Parameters:

  • thread_id (String)

    Identifier of the ChatKit thread whose items are requested.

  • after (String)

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

  • before (String)

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

  • limit (Integer)

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

  • order (Symbol, OpenAI::Models::Beta::ChatKit::ThreadListItemsParams::Order)

    Sort order for results by creation time. Defaults to ‘desc`.

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

Returns:

See Also:



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

def list_items(thread_id, params = {})
  parsed, options = OpenAI::Beta::ChatKit::ThreadListItemsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["chatkit/threads/%1$s/items", thread_id],
    query: parsed,
    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

Parameters:

  • thread_id (String)

    Identifier of the ChatKit thread to retrieve.

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

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