Class: RubyCode::Configuration
- Inherits:
-
Object
- Object
- RubyCode::Configuration
- Defined in:
- lib/rubycode/configuration.rb
Overview
Configuration class for Rubycode settings
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#adapter_request_delay ⇒ Object
Returns the value of attribute adapter_request_delay.
-
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
-
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#memory_window ⇒ Object
Returns the value of attribute memory_window.
-
#model ⇒ Object
Returns the value of attribute model.
-
#prune_tool_results ⇒ Object
Returns the value of attribute prune_tool_results.
-
#retry_base_delay ⇒ Object
Returns the value of attribute retry_base_delay.
-
#root_path ⇒ Object
Returns the value of attribute root_path.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#load_from_hash(hash) ⇒ Object
Load configuration from a hash.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubycode/configuration.rb', line 10 def initialize @adapter = :ollama @url = "https://api.ollama.com" @model = "qwen3-coder:480b-cloud" @root_path = Dir.pwd # HTTP timeout and retry configuration @http_read_timeout = 120 # 2 minutes for LLM inference @http_open_timeout = 10 # 10 seconds for connection @max_retries = 3 # Number of retries (4 total attempts) @retry_base_delay = 2.0 # Base delay for exponential backoff # Rate limiting configuration @adapter_request_delay = 1.5 # Delay between consecutive requests (seconds) # Memory optimization configuration @memory_window = 10 # Keep last N messages for context @prune_tool_results = true # Replace old tool results with placeholder end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def adapter @adapter end |
#adapter_request_delay ⇒ Object
Returns the value of attribute adapter_request_delay.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def adapter_request_delay @adapter_request_delay end |
#http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def http_read_timeout @http_read_timeout end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def max_retries @max_retries end |
#memory_window ⇒ Object
Returns the value of attribute memory_window.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def memory_window @memory_window end |
#model ⇒ Object
Returns the value of attribute model.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def model @model end |
#prune_tool_results ⇒ Object
Returns the value of attribute prune_tool_results.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def prune_tool_results @prune_tool_results end |
#retry_base_delay ⇒ Object
Returns the value of attribute retry_base_delay.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def retry_base_delay @retry_base_delay end |
#root_path ⇒ Object
Returns the value of attribute root_path.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def root_path @root_path end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/rubycode/configuration.rb', line 6 def url @url end |
Instance Method Details
#load_from_hash(hash) ⇒ Object
Load configuration from a hash
32 33 34 35 36 37 |
# File 'lib/rubycode/configuration.rb', line 32 def load_from_hash(hash) @adapter = hash[:adapter] if hash.key?(:adapter) @model = hash[:model] if hash.key?(:model) @url = hash[:url] if hash.key?(:url) @root_path = hash[:root_path] if hash.key?(:root_path) end |