Class: OpenAI::Models

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

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil, organization_id: nil) ⇒ Models

Returns a new instance of Models.



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

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

Instance Method Details

#listObject



8
9
10
# File 'lib/openai/models.rb', line 8

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

#retrieve(id:) ⇒ Object



12
13
14
# File 'lib/openai/models.rb', line 12

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