Class: OpenAI::Runs

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Runs

Returns a new instance of Runs.



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

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

Instance Method Details

#cancel(id:, thread_id:) ⇒ Object



24
25
26
# File 'lib/openai/runs.rb', line 24

def cancel(id:, thread_id:)
  @client.post(path: "/threads/#{thread_id}/runs/#{id}/cancel")
end

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



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

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

#create_thread_and_run(parameters: {}) ⇒ Object



28
29
30
# File 'lib/openai/runs.rb', line 28

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

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



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

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

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



20
21
22
# File 'lib/openai/runs.rb', line 20

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

#retrieve(thread_id:, id:) ⇒ Object



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

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

#submit_tool_outputs(thread_id:, run_id:, parameters: {}) ⇒ Object



32
33
34
35
# File 'lib/openai/runs.rb', line 32

def submit_tool_outputs(thread_id:, run_id:, parameters: {})
  @client.json_post(path: "/threads/#{thread_id}/runs/#{run_id}/submit_tool_outputs",
                    parameters: parameters)
end