Sha256: 69d130e902d0e9f2744f6ac2ad0de889c19d2a74e8569e0353dc072b1415ea68
Contents?: true
Size: 988 Bytes
Versions: 2
Compression:
Stored size: 988 Bytes
Contents
module OpenAI class Models 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}/models", headers: { "Content-Type" => "application/json", "Authorization" => "Bearer #{@access_token}", "OpenAI-Organization" => @organization_id } ) end def retrieve(id:, version: default_version) self.class.get( "/#{version}/models/#{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/models.rb |
ruby-openai-2.2.0 | lib/ruby/openai/models.rb |