Class: Openai::Client::Models

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

Constant Summary collapse

PATH =
'models'

Instance Method Summary collapse

Instance Method Details

#delete(id) ⇒ Hash

Public: Makes an API call to delete a model.

Parameters:

  • id (String)

    model id

Returns:

  • (Hash)

    the model



36
37
38
39
40
# File 'lib/openai/client/models.rb', line 36

def delete(id)
  Http.new.delete("#{PATH}/#{id}").body
rescue Faraday::Error
  nil
end

#find(id) ⇒ Hash

Public: Makes an API call to find the model by the ID.

Parameters:

  • id (String)

    model id

Returns:

  • (Hash)

    found model



24
25
26
27
28
# File 'lib/openai/client/models.rb', line 24

def find(id)
  Http.new.get("#{PATH}/#{id}").body
rescue Faraday::Error
  nil
end

#listHash

Public: Makes an API call to return all models.

Returns:

  • (Hash)

    a hash with models



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

def list
  Http.new.get(PATH).body
rescue Faraday::Error
  nil
end