Class: OpenAI::Messages

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Messages

Returns a new instance of Messages.



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

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

Instance Method Details

#create(thread_id:, parameters: {}) ⇒ Object



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

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

#delete(thread_id:, id:) ⇒ Object



23
24
25
# File 'lib/openai/messages.rb', line 23

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

#list(thread_id:, parameters: {}) ⇒ Object



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

def list(thread_id:, parameters: {})
  @client.get(path: "/threads/#{thread_id}/messages", parameters: parameters)
end

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



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

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

#retrieve(thread_id:, id:) ⇒ Object



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

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