Class: OpenAI::Threads

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Threads

Returns a new instance of Threads.



3
4
5
# File 'lib/openai/threads.rb', line 3

def initialize(client:)
  @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION)
end

Instance Method Details

#create(parameters: {}) ⇒ Object



11
12
13
# File 'lib/openai/threads.rb', line 11

def create(parameters: {})
  @client.json_post(path: "/threads", parameters: parameters)
end

#delete(id:) ⇒ Object



19
20
21
# File 'lib/openai/threads.rb', line 19

def delete(id:)
  @client.delete(path: "/threads/#{id}")
end

#modify(id:, parameters: {}) ⇒ Object



15
16
17
# File 'lib/openai/threads.rb', line 15

def modify(id:, parameters: {})
  @client.json_post(path: "/threads/#{id}", parameters: parameters)
end

#retrieve(id:) ⇒ Object



7
8
9
# File 'lib/openai/threads.rb', line 7

def retrieve(id:)
  @client.get(path: "/threads/#{id}")
end