Class: Prescient::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/prescient.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_providerObject

Returns the value of attribute default_provider.



40
41
42
# File 'lib/prescient.rb', line 40

def default_provider
  @default_provider
end

#providersObject (readonly)

Returns the value of attribute providers.



44
45
46
# File 'lib/prescient.rb', line 44

def providers
  @providers
end

#retry_attemptsObject

Returns the value of attribute retry_attempts.



42
43
44
# File 'lib/prescient.rb', line 42

def retry_attempts
  @retry_attempts
end

#retry_delayObject

Returns the value of attribute retry_delay.



43
44
45
# File 'lib/prescient.rb', line 43

def retry_delay
  @retry_delay
end

#timeoutObject

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, **options)
  @providers[name.to_sym] = {
    class:   provider_class,
    options: 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