File: models.rb

package info (click to toggle)
ruby-ruby-openai 3.7.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 200 kB
  • sloc: ruby: 243; makefile: 4; sh: 4
file content (16 lines) | stat: -rw-r--r-- 401 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module OpenAI
  class Models
    def initialize(access_token: nil, organization_id: nil)
      OpenAI.configuration.access_token = access_token if access_token
      OpenAI.configuration.organization_id = organization_id if organization_id
    end

    def list
      OpenAI::Client.get(path: "/models")
    end

    def retrieve(id:)
      OpenAI::Client.get(path: "/models/#{id}")
    end
  end
end