Class: Roseflow::OpenAI::ModelRepository
- Inherits:
-
Object
- Object
- Roseflow::OpenAI::ModelRepository
- Defined in:
- lib/roseflow/openai/model_repository.rb
Instance Attribute Summary collapse
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Instance Method Summary collapse
-
#chattable ⇒ Object
Returns all models that are chattable.
-
#completionable ⇒ Object
Returns all models that are completionable.
-
#editable ⇒ Object
Returns all models that are support edits.
-
#embeddable ⇒ Object
Returns all models that are support embeddings.
-
#find(name) ⇒ Object
Finds a model by name.
-
#initialize(provider) ⇒ ModelRepository
constructor
A new instance of ModelRepository.
Constructor Details
#initialize(provider) ⇒ ModelRepository
Returns a new instance of ModelRepository.
12 13 14 15 |
# File 'lib/roseflow/openai/model_repository.rb', line 12 def initialize(provider) @provider = provider @models = provider.client.models end |
Instance Attribute Details
#models ⇒ Object (readonly)
Returns the value of attribute models.
8 9 10 |
# File 'lib/roseflow/openai/model_repository.rb', line 8 def models @models end |
Instance Method Details
#chattable ⇒ Object
Returns all models that are chattable.
25 26 27 |
# File 'lib/roseflow/openai/model_repository.rb', line 25 def chattable @models.select(&:chattable?) end |
#completionable ⇒ Object
Returns all models that are completionable.
30 31 32 |
# File 'lib/roseflow/openai/model_repository.rb', line 30 def completionable @models.select(&:completionable?) end |
#editable ⇒ Object
Returns all models that are support edits.
35 36 37 |
# File 'lib/roseflow/openai/model_repository.rb', line 35 def editable @models.select(&:editable?) end |
#embeddable ⇒ Object
Returns all models that are support embeddings.
40 41 42 |
# File 'lib/roseflow/openai/model_repository.rb', line 40 def @models.select(&:embeddable?) end |
#find(name) ⇒ Object
Finds a model by name.
20 21 22 |
# File 'lib/roseflow/openai/model_repository.rb', line 20 def find(name) @models.select{ |model| model.name == name }.first end |