Module: AIHype::Env
- Defined in:
- lib/aihype/env.rb
Class Method Summary collapse
-
.all ⇒ Object
All environment variables used by aihype.
-
.anthropic_api_key ⇒ Object
Anthropic API configuration.
-
.api_timeout ⇒ Object
Timeout for API requests (in seconds).
-
.config_path ⇒ Object
Configuration file path.
-
.log_path ⇒ Object
Log file path.
-
.model ⇒ Object
Model selection Can be overridden to force a specific model.
-
.model_preference ⇒ Object
Model selection preference: fast, cheap, balanced, powerful.
-
.rate_limit_rpm ⇒ Object
Rate limiting - requests per minute.
-
.rate_limit_window ⇒ Object
Rate limiting - window size in seconds.
-
.verbose? ⇒ Boolean
Enable verbose logging.
Class Method Details
.all ⇒ Object
All environment variables used by aihype
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/aihype/env.rb', line 65 def self.all { anthropic_api_key: anthropic_api_key, model: model, model_preference: model_preference, api_timeout: api_timeout, verbose: verbose?, config_path: config_path, log_path: log_path, rate_limit_rpm: rate_limit_rpm, rate_limit_window: rate_limit_window } end |
.anthropic_api_key ⇒ Object
Anthropic API configuration
6 7 8 |
# File 'lib/aihype/env.rb', line 6 def self.anthropic_api_key ENV['ANTHROPIC_API_KEY'] end |
.api_timeout ⇒ Object
Timeout for API requests (in seconds)
25 26 27 28 29 30 |
# File 'lib/aihype/env.rb', line 25 def self.api_timeout timeout = ENV['AIHYPE_API_TIMEOUT'] return 5 unless timeout # Increased to 5 seconds to account for rate limiting timeout.to_i end |
.config_path ⇒ Object
Configuration file path
39 40 41 |
# File 'lib/aihype/env.rb', line 39 def self.config_path ENV['AIHYPE_CONFIG'] || 'memory/aihype.md' end |
.log_path ⇒ Object
Log file path
44 45 46 |
# File 'lib/aihype/env.rb', line 44 def self.log_path ENV['AIHYPE_LOG'] || 'memory/aihype.log' end |
.model ⇒ Object
Model selection Can be overridden to force a specific model
12 13 14 |
# File 'lib/aihype/env.rb', line 12 def self.model ENV['AIHYPE_MODEL'] end |
.model_preference ⇒ Object
Model selection preference: fast, cheap, balanced, powerful
17 18 19 20 21 22 |
# File 'lib/aihype/env.rb', line 17 def self.model_preference pref = ENV['AIHYPE_MODEL_PREFERENCE'] return :cheap unless pref pref.to_sym end |
.rate_limit_rpm ⇒ Object
Rate limiting - requests per minute
49 50 51 52 53 54 |
# File 'lib/aihype/env.rb', line 49 def self.rate_limit_rpm rpm = ENV['AIHYPE_RATE_LIMIT_RPM'] return 50 unless rpm # Default to 50 requests per minute rpm.to_i end |
.rate_limit_window ⇒ Object
Rate limiting - window size in seconds
57 58 59 60 61 62 |
# File 'lib/aihype/env.rb', line 57 def self.rate_limit_window window = ENV['AIHYPE_RATE_LIMIT_WINDOW'] return 60 unless window # Default to 60 seconds window.to_i end |
.verbose? ⇒ Boolean
Enable verbose logging
33 34 35 36 |
# File 'lib/aihype/env.rb', line 33 def self.verbose? value = ENV['AIHYPE_VERBOSE'] ['1', 'true', 'yes'].include?(value&.downcase) end |