Class: NitroIntelligence::ModelCatalog
- Inherits:
-
Object
- Object
- NitroIntelligence::ModelCatalog
- Defined in:
- lib/nitro_intelligence/models/model_catalog.rb
Instance Attribute Summary collapse
-
#default_audio_transcription_model ⇒ Object
readonly
Returns the value of attribute default_audio_transcription_model.
-
#default_image_model ⇒ Object
readonly
Returns the value of attribute default_image_model.
-
#default_text_model ⇒ Object
readonly
Returns the value of attribute default_text_model.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Instance Method Summary collapse
- #exists?(name) ⇒ Boolean
-
#initialize(model_config) ⇒ ModelCatalog
constructor
A new instance of ModelCatalog.
- #lookup_by_name(name) ⇒ Object
Constructor Details
#initialize(model_config) ⇒ ModelCatalog
Returns a new instance of ModelCatalog.
7 8 9 10 11 12 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 7 def initialize(model_config) @models = (model_config[:models] || []).map { || ModelFactory.build() } @default_audio_transcription_model = lookup_by_name(model_config[:default_audio_transcription_model]) @default_image_model = lookup_by_name(model_config[:default_image_model]) @default_text_model = lookup_by_name(model_config[:default_text_model]) end |
Instance Attribute Details
#default_audio_transcription_model ⇒ Object (readonly)
Returns the value of attribute default_audio_transcription_model.
5 6 7 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 5 def default_audio_transcription_model @default_audio_transcription_model end |
#default_image_model ⇒ Object (readonly)
Returns the value of attribute default_image_model.
5 6 7 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 5 def default_image_model @default_image_model end |
#default_text_model ⇒ Object (readonly)
Returns the value of attribute default_text_model.
5 6 7 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 5 def default_text_model @default_text_model end |
#models ⇒ Object (readonly)
Returns the value of attribute models.
5 6 7 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 5 def models @models end |
Instance Method Details
#exists?(name) ⇒ Boolean
18 19 20 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 18 def exists?(name) lookup_by_name(name).present? end |
#lookup_by_name(name) ⇒ Object
14 15 16 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 14 def lookup_by_name(name) @models.find { |model| model.name == name } end |