Class: LLM::Model
Overview
The LLM::Model class represents an LLM model that is available to use. Its properties are delegated to the underlying response body, and vary by provider.
Instance Attribute Summary collapse
-
#provider ⇒ LLM::Provider
Returns a subclass of LLM::Provider.
Instance Method Summary collapse
-
#id ⇒ String
Returns the model ID.
-
#to_json ⇒ String
Methods inherited from Object
#[], #[]=, #each, #empty?, #initialize, #to_h
Constructor Details
This class inherits a constructor from LLM::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class LLM::Object
Instance Attribute Details
#provider ⇒ LLM::Provider
Returns a subclass of LLM::Provider
11 12 13 |
# File 'lib/llm/model.rb', line 11 def provider @provider end |
Instance Method Details
#id ⇒ String
Returns the model ID
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/llm/model.rb', line 16 def id case @provider.class.to_s when "LLM::Ollama" self["name"] when "LLM::Gemini" self["name"].sub(%r|\Amodels/|, "") else self["id"] end end |
#to_json ⇒ String
29 30 31 |
# File 'lib/llm/model.rb', line 29 def to_json(*) id.to_json(*) end |