Sha256: 98430539a5d5750fb3b89ab13d28c7b430919cf75d1360b6952759edd20abced

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

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

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

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

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

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

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

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

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-openai-7.3.1 lib/openai/runs.rb
ruby-openai-7.3.0 lib/openai/runs.rb