Class: LLM::Model
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- LLM::Model
- Defined in:
- lib/llm/model.rb
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 included from OpenStruct::FromHash
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 |