Class: Rixie::Configuration
- Inherits:
-
Object
- Object
- Rixie::Configuration
- Defined in:
- lib/rixie/configuration.rb
Constant Summary collapse
- LOG_FORMATS =
%i[text json].freeze
Instance Attribute Summary collapse
-
#custom_providers ⇒ Object
readonly
Returns the value of attribute custom_providers.
-
#default_max_steps ⇒ Object
Returns the value of attribute default_max_steps.
-
#default_max_tokens ⇒ Object
Returns the value of attribute default_max_tokens.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#default_provider ⇒ Object
Returns the value of attribute default_provider.
-
#default_subscribers ⇒ Object
Returns the value of attribute default_subscribers.
-
#default_temperature ⇒ Object
Returns the value of attribute default_temperature.
-
#log_format ⇒ Object
Returns the value of attribute log_format.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_provider(name, adapter:, base_url:, api_key:) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rixie/configuration.rb', line 30 def initialize @default_provider = nil @default_model = nil @default_max_steps = 10 @store = nil @log_level = :info @log_format = :text @logger = Logger.new($stdout).tap do |l| l.level = ::Logger.const_get(@log_level.to_s.upcase) l.formatter = proc { |severity, datetime, _progname, msg| "#{datetime.strftime("%Y-%m-%d %H:%M:%S.%3N")} #{severity} #{msg}\n" } end @request_timeout = nil @default_max_tokens = nil @default_temperature = nil @default_subscribers = nil @custom_providers = {} end |
Instance Attribute Details
#custom_providers ⇒ Object (readonly)
Returns the value of attribute custom_providers.
54 55 56 |
# File 'lib/rixie/configuration.rb', line 54 def custom_providers @custom_providers end |
#default_max_steps ⇒ Object
Returns the value of attribute default_max_steps.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_max_steps @default_max_steps end |
#default_max_tokens ⇒ Object
Returns the value of attribute default_max_tokens.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_max_tokens @default_max_tokens end |
#default_model ⇒ Object
Returns the value of attribute default_model.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_model @default_model end |
#default_provider ⇒ Object
Returns the value of attribute default_provider.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_provider @default_provider end |
#default_subscribers ⇒ Object
Returns the value of attribute default_subscribers.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_subscribers @default_subscribers end |
#default_temperature ⇒ Object
Returns the value of attribute default_temperature.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def default_temperature @default_temperature end |
#log_format ⇒ Object
Returns the value of attribute log_format.
10 11 12 |
# File 'lib/rixie/configuration.rb', line 10 def log_format @log_format end |
#log_level ⇒ Object
Returns the value of attribute log_level.
10 11 12 |
# File 'lib/rixie/configuration.rb', line 10 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/rixie/configuration.rb', line 10 def logger @logger end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def request_timeout @request_timeout end |
#store ⇒ Object
Returns the value of attribute store.
9 10 11 |
# File 'lib/rixie/configuration.rb', line 9 def store @store end |
Instance Method Details
#register_provider(name, adapter:, base_url:, api_key:) ⇒ Object
50 51 52 |
# File 'lib/rixie/configuration.rb', line 50 def register_provider(name, adapter:, base_url:, api_key:) @custom_providers[name.to_s] = {adapter: adapter, base_url: base_url, api_key: api_key} end |