Class: GroqRuby::Resources::Models

Inherits:
Base
  • Object
show all
Defined in:
lib/groq_ruby/resources/models.rb

Overview

‘client.models.list / retrieve / delete`.

Examples:

List

client.models.list.data.each { |m| puts m.id }

Retrieve

client.models.retrieve("llama-3.3-70b-versatile")

Constant Summary collapse

BASE_PATH =
"/openai/v1/models".freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GroqRuby::Resources::Base

Instance Method Details

#delete(model_id) ⇒ GroqRuby::Models::ModelDeleted

Parameters:

  • model_id (String)

Returns:



29
30
31
32
# File 'lib/groq_ruby/resources/models.rb', line 29

def delete(model_id)
  payload = perform(Request.new(method: :delete, path: "#{BASE_PATH}/#{model_id}"))
  GroqRuby::Models::ModelDeleted.from_hash(payload)
end

#listGroqRuby::Models::ModelList



14
15
16
17
# File 'lib/groq_ruby/resources/models.rb', line 14

def list
  payload = perform(Request.new(method: :get, path: BASE_PATH))
  GroqRuby::Models::ModelList.from_hash(payload)
end

#retrieve(model_id) ⇒ GroqRuby::Models::Model

Parameters:

  • model_id (String)

Returns:

Raises:



22
23
24
25
# File 'lib/groq_ruby/resources/models.rb', line 22

def retrieve(model_id)
  payload = perform(Request.new(method: :get, path: "#{BASE_PATH}/#{model_id}"))
  GroqRuby::Models::Model.from_hash(payload)
end