Class: TestProvider
- Inherits:
-
LastLLM::Provider
- Object
- LastLLM::Provider
- TestProvider
- Defined in:
- lib/last_llm/providers/test_provider.rb
Overview
A provider implementation for testing purposes
Instance Attribute Summary collapse
-
#object_response ⇒ Object
Returns the value of attribute object_response.
-
#text_response ⇒ Object
Returns the value of attribute text_response.
Attributes inherited from LastLLM::Provider
Instance Method Summary collapse
- #generate_object(_prompt, _schema, _options = {}) ⇒ Object
- #generate_text(_prompt, _options = {}) ⇒ Object
-
#initialize(config = {}) ⇒ TestProvider
constructor
A new instance of TestProvider.
-
#validate_config! ⇒ Object
Override validate_config! to not require API key.
Methods inherited from LastLLM::Provider
#handle_request_error, #parse_response
Constructor Details
#initialize(config = {}) ⇒ TestProvider
Returns a new instance of TestProvider.
9 10 11 12 13 14 15 16 |
# File 'lib/last_llm/providers/test_provider.rb', line 9 def initialize(config = {}) # Skip parent's initialize which checks for API key # Instead implement our own initialization @config = config.is_a?(Hash) ? config : {} @name = Constants::TEST @text_response = 'Test response' @object_response = {} end |
Instance Attribute Details
#object_response ⇒ Object
Returns the value of attribute object_response.
7 8 9 |
# File 'lib/last_llm/providers/test_provider.rb', line 7 def object_response @object_response end |
#text_response ⇒ Object
Returns the value of attribute text_response.
7 8 9 |
# File 'lib/last_llm/providers/test_provider.rb', line 7 def text_response @text_response end |
Instance Method Details
#generate_object(_prompt, _schema, _options = {}) ⇒ Object
27 28 29 |
# File 'lib/last_llm/providers/test_provider.rb', line 27 def generate_object(_prompt, _schema, = {}) @object_response end |
#generate_text(_prompt, _options = {}) ⇒ Object
23 24 25 |
# File 'lib/last_llm/providers/test_provider.rb', line 23 def generate_text(_prompt, = {}) @text_response end |
#validate_config! ⇒ Object
Override validate_config! to not require API key
19 20 21 |
# File 'lib/last_llm/providers/test_provider.rb', line 19 def validate_config! # No validation needed for test provider end |