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.
-
#default_text_to_speech_model ⇒ Object
readonly
Returns the value of attribute default_text_to_speech_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.
11 12 13 14 15 16 17 18 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 11 def initialize(model_config) model_config = model_config.symbolize_keys @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]) @default_text_to_speech_model = lookup_by_name(model_config[:default_text_to_speech_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 |
#default_text_to_speech_model ⇒ Object (readonly)
Returns the value of attribute default_text_to_speech_model.
5 6 7 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 5 def default_text_to_speech_model @default_text_to_speech_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
24 25 26 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 24 def exists?(name) lookup_by_name(name).present? end |
#lookup_by_name(name) ⇒ Object
20 21 22 |
# File 'lib/nitro_intelligence/models/model_catalog.rb', line 20 def lookup_by_name(name) @models.find { |model| model.name == name } end |