Class: AISpec::Core::Providers::Base
- Inherits:
-
Object
- Object
- AISpec::Core::Providers::Base
- Defined in:
- lib/aispec/core/providers/base.rb
Class Attribute Summary collapse
-
.registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #generate(prompt, **params) ⇒ Object
-
#initialize(model: nil, **options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(model: nil, **options) ⇒ Base
Returns a new instance of Base.
24 25 26 27 |
# File 'lib/aispec/core/providers/base.rb', line 24 def initialize(model: nil, **) @model = model @options = end |
Class Attribute Details
.registry ⇒ Object (readonly)
Returns the value of attribute registry.
10 11 12 |
# File 'lib/aispec/core/providers/base.rb', line 10 def registry @registry end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
22 23 24 |
# File 'lib/aispec/core/providers/base.rb', line 22 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
22 23 24 |
# File 'lib/aispec/core/providers/base.rb', line 22 def @options end |
Class Method Details
.get(name) ⇒ Object
16 17 18 19 |
# File 'lib/aispec/core/providers/base.rb', line 16 def get(name) key = name.to_s.downcase @registry[key] || Mock end |
.register(name, provider_class) ⇒ Object
12 13 14 |
# File 'lib/aispec/core/providers/base.rb', line 12 def register(name, provider_class) @registry[name.to_s.downcase] = provider_class end |
Instance Method Details
#generate(prompt, **params) ⇒ Object
29 30 31 |
# File 'lib/aispec/core/providers/base.rb', line 29 def generate(prompt, **params) raise NotImplementedError, "#{self.class.name} must implement #generate" end |