Class: Prescient::Base
- Inherits:
-
Object
- Object
- Prescient::Base
- Defined in:
- lib/prescient/base.rb
Direct Known Subclasses
Provider::Anthropic, Provider::HuggingFace, Provider::Ollama, Provider::OpenAI
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#generate_embedding(text) ⇒ Object
Abstract methods that must be implemented by subclasses.
- #generate_response(prompt, context_items = [], **options) ⇒ Object
- #health_check ⇒ Object
-
#initialize(**options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(**options) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/prescient/base.rb', line 6 def initialize(**) @options = validate_configuration! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/prescient/base.rb', line 4 def @options end |
Instance Method Details
#available? ⇒ Boolean
24 25 26 27 28 |
# File 'lib/prescient/base.rb', line 24 def available? health_check[:status] == 'healthy' rescue StandardError false end |
#generate_embedding(text) ⇒ Object
Abstract methods that must be implemented by subclasses
12 13 14 |
# File 'lib/prescient/base.rb', line 12 def (text) raise NotImplementedError, "#{self.class} must implement #generate_embedding" end |
#generate_response(prompt, context_items = [], **options) ⇒ Object
16 17 18 |
# File 'lib/prescient/base.rb', line 16 def generate_response(prompt, context_items = [], **) raise NotImplementedError, "#{self.class} must implement #generate_response" end |
#health_check ⇒ Object
20 21 22 |
# File 'lib/prescient/base.rb', line 20 def health_check raise NotImplementedError, "#{self.class} must implement #health_check" end |