Class: MagicQuery::Providers::Base
- Inherits:
-
Object
- Object
- MagicQuery::Providers::Base
- Defined in:
- lib/magic_query/providers/base.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#max_tokens ⇒ Object
readonly
Returns the value of attribute max_tokens.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
- #generate(prompt) ⇒ Object
-
#initialize(api_key:, model: nil, temperature: 0.3, max_tokens: 1000) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(api_key:, model: nil, temperature: 0.3, max_tokens: 1000) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 |
# File 'lib/magic_query/providers/base.rb', line 10 def initialize(api_key:, model: nil, temperature: 0.3, max_tokens: 1000) @api_key = api_key @model = model || default_model @temperature = temperature @max_tokens = max_tokens end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/magic_query/providers/base.rb', line 8 def api_key @api_key end |
#max_tokens ⇒ Object (readonly)
Returns the value of attribute max_tokens.
8 9 10 |
# File 'lib/magic_query/providers/base.rb', line 8 def max_tokens @max_tokens end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/magic_query/providers/base.rb', line 8 def model @model end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
8 9 10 |
# File 'lib/magic_query/providers/base.rb', line 8 def temperature @temperature end |
Instance Method Details
#generate(prompt) ⇒ Object
17 18 19 |
# File 'lib/magic_query/providers/base.rb', line 17 def generate(prompt) raise NotImplementedError, 'Subclasses must implement #generate' end |