Class: Soka::Rails::Configuration
- Inherits:
-
Object
- Object
- Soka::Rails::Configuration
- Defined in:
- lib/soka/rails/configuration.rb
Overview
Main configuration class for Soka Rails settings
Defined Under Namespace
Classes: AIConfig, PerformanceConfig
Instance Attribute Summary collapse
-
#ai_api_key ⇒ Object
Returns the value of attribute ai_api_key.
-
#ai_model ⇒ Object
Returns the value of attribute ai_model.
-
#ai_provider ⇒ Object
Returns the value of attribute ai_provider.
-
#max_iterations ⇒ Object
Returns the value of attribute max_iterations.
Instance Method Summary collapse
-
#ai {|AIConfig.new(self)| ... } ⇒ Object
DSL configuration methods.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #performance {|PerformanceConfig.new(self)| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 |
# File 'lib/soka/rails/configuration.rb', line 9 def initialize # Use ENV.fetch to set default values @ai_provider = ENV.fetch('SOKA_PROVIDER', :gemini).to_sym @ai_model = ENV.fetch('SOKA_MODEL', 'gemini-2.5-flash-lite') @ai_api_key = ENV.fetch('SOKA_API_KEY', nil) # Performance settings @max_iterations = defined?(::Rails) && ::Rails.env.production? ? 10 : 5 end |
Instance Attribute Details
#ai_api_key ⇒ Object
Returns the value of attribute ai_api_key.
7 8 9 |
# File 'lib/soka/rails/configuration.rb', line 7 def ai_api_key @ai_api_key end |
#ai_model ⇒ Object
Returns the value of attribute ai_model.
7 8 9 |
# File 'lib/soka/rails/configuration.rb', line 7 def ai_model @ai_model end |
#ai_provider ⇒ Object
Returns the value of attribute ai_provider.
7 8 9 |
# File 'lib/soka/rails/configuration.rb', line 7 def ai_provider @ai_provider end |
#max_iterations ⇒ Object
Returns the value of attribute max_iterations.
7 8 9 |
# File 'lib/soka/rails/configuration.rb', line 7 def max_iterations @max_iterations end |
Instance Method Details
#ai {|AIConfig.new(self)| ... } ⇒ Object
DSL configuration methods
20 21 22 |
# File 'lib/soka/rails/configuration.rb', line 20 def ai yield(AIConfig.new(self)) if block_given? end |
#performance {|PerformanceConfig.new(self)| ... } ⇒ Object
24 25 26 |
# File 'lib/soka/rails/configuration.rb', line 24 def performance yield(PerformanceConfig.new(self)) if block_given? end |