Class: Groq::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/groq/model.rb

Constant Summary collapse

MODELS =
[
  {
    name: "LLaMA3 8b",
    model_id: "llama3-8b-8192",
    developer: "Meta",
    context_window: 8192,
    model_card: "https://huggingface.co/meta-llama/Meta-Llama-3-8B"
  },
  {
    name: "LLaMA3 70b",
    model_id: "llama3-70b-8192",
    developer: "Meta",
    context_window: 8192,
    model_card: "https://huggingface.co/meta-llama/Meta-Llama-3-70B"
  },
  {
    name: "LLaMA2 70b",
    model_id: "llama2-70b-4096",
    developer: "Meta",
    context_window: 4096,
    model_card: "https://huggingface.co/meta-llama/Llama-2-70b"
  },
  {
    name: "Mixtral 8x7b",
    model_id: "mixtral-8x7b-32768",
    developer: "Mistral",
    context_window: 32768,
    model_card: "https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1"
  },
  {
    name: "Gemma 7b",
    model_id: "gemma-7b-it",
    developer: "Google",
    context_window: 8192,
    model_card: "https://huggingface.co/google/gemma-1.1-7b-it"
  }
]

Class Method Summary collapse

Class Method Details

.default_modelObject



45
46
47
# File 'lib/groq/model.rb', line 45

def default_model
  MODELS.first
end

.default_model_idObject



49
50
51
# File 'lib/groq/model.rb', line 49

def default_model_id
  default_model[:model_id]
end

.load_models(client:) ⇒ Object

api.groq.com/openai/v1/models Output: {“object”: “list”, “data”: [

{
    "id": "gemma-7b-it",
    "object": "model",
    "created": 1693721698,
    "owned_by": "Google",
    "active": true,
    "context_window": 8192
},


65
66
67
68
69
# File 'lib/groq/model.rb', line 65

def load_models(client:)
  client ||= Groq::Client.new
  response = client.get(path: "/openai/v1/models")
  response.body
end

.model_idsObject



41
42
43
# File 'lib/groq/model.rb', line 41

def model_ids
  MODELS.map { |m| m[:model_id] }
end