Class: Prescient::Configuration
- Inherits:
-
Object
- Object
- Prescient::Configuration
- Defined in:
- lib/prescient.rb
Instance Attribute Summary collapse
-
#default_provider ⇒ Object
Returns the value of attribute default_provider.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
-
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #add_provider(name, provider_class, **options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #provider(name) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
46 47 48 49 50 51 52 |
# File 'lib/prescient.rb', line 46 def initialize @default_provider = :ollama @timeout = 30 @retry_attempts = 3 @retry_delay = 1.0 @providers = {} end |
Instance Attribute Details
#default_provider ⇒ Object
Returns the value of attribute default_provider.
40 41 42 |
# File 'lib/prescient.rb', line 40 def default_provider @default_provider end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
44 45 46 |
# File 'lib/prescient.rb', line 44 def providers @providers end |
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
42 43 44 |
# File 'lib/prescient.rb', line 42 def retry_attempts @retry_attempts end |
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
43 44 45 |
# File 'lib/prescient.rb', line 43 def retry_delay @retry_delay end |
#timeout ⇒ Object
Returns the value of attribute timeout.
41 42 43 |
# File 'lib/prescient.rb', line 41 def timeout @timeout end |
Instance Method Details
#add_provider(name, provider_class, **options) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/prescient.rb', line 54 def add_provider(name, provider_class, **) @providers[name.to_sym] = { class: provider_class, options: , } end |
#provider(name) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/prescient.rb', line 61 def provider(name) provider_config = @providers[name.to_sym] return nil unless provider_config provider_config[:class].new(**provider_config[:options]) end |