Sha256: fab7b5f385726f68f82d5d383f615bac83c4157f8ec74f9f9baa7e365f225047
Contents?: true
Size: 991 Bytes
Versions: 2
Compression:
Stored size: 991 Bytes
Contents
module OpenAI class Engines include HTTParty base_uri "https://api.openai.com" def initialize(access_token: nil, organization_id: nil) @access_token = access_token || ENV.fetch("OPENAI_ACCESS_TOKEN") @organization_id = organization_id || ENV.fetch("OPENAI_ORGANIZATION_ID", nil) end def list(version: default_version) self.class.get( "/#{version}/engines", headers: { "Content-Type" => "application/json", "Authorization" => "Bearer #{@access_token}", "OpenAI-Organization" => @organization_id } ) end def retrieve(id:, version: default_version) self.class.get( "/#{version}/engines/#{id}", headers: { "Content-Type" => "application/json", "Authorization" => "Bearer #{@access_token}", "OpenAI-Organization" => @organization_id } ) end private def default_version "v1".freeze end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-openai-2.3.0 | lib/ruby/openai/engines.rb |
ruby-openai-2.2.0 | lib/ruby/openai/engines.rb |