Class: Qualspec::Configuration
- Inherits:
-
Object
- Object
- Qualspec::Configuration
- Defined in:
- lib/qualspec/configuration.rb
Constant Summary collapse
- DEFAULT_API_URL =
'https://openrouter.ai/api/v1'- DEFAULT_MODEL =
'google/gemini-3-flash-preview'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#judge_model ⇒ Object
Returns the value of attribute judge_model.
-
#judge_system_prompt ⇒ Object
Returns the value of attribute judge_system_prompt.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
Instance Method Summary collapse
- #api_headers ⇒ Object
- #api_key_configured? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/qualspec/configuration.rb', line 11 def initialize @api_url = ENV.fetch('QUALSPEC_API_URL', DEFAULT_API_URL) @api_key = ENV['QUALSPEC_API_KEY'] @default_model = ENV.fetch('QUALSPEC_MODEL', DEFAULT_MODEL) @judge_model = ENV.fetch('QUALSPEC_JUDGE_MODEL') { @default_model } @cache_enabled = false @cache_dir = '.qualspec_cache' @judge_system_prompt = nil # Uses default if nil @request_timeout = 120 end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def api_key @api_key end |
#api_url ⇒ Object
Returns the value of attribute api_url.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def api_url @api_url end |
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def cache_dir @cache_dir end |
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def cache_enabled @cache_enabled end |
#default_model ⇒ Object
Returns the value of attribute default_model.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def default_model @default_model end |
#judge_model ⇒ Object
Returns the value of attribute judge_model.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def judge_model @judge_model end |
#judge_system_prompt ⇒ Object
Returns the value of attribute judge_system_prompt.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def judge_system_prompt @judge_system_prompt end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
5 6 7 |
# File 'lib/qualspec/configuration.rb', line 5 def request_timeout @request_timeout end |
Instance Method Details
#api_headers ⇒ Object
22 23 24 25 26 |
# File 'lib/qualspec/configuration.rb', line 22 def api_headers headers = { 'Content-Type' => 'application/json' } headers['Authorization'] = "Bearer #{@api_key}" unless @api_key.to_s.empty? headers end |
#api_key_configured? ⇒ Boolean
28 29 30 |
# File 'lib/qualspec/configuration.rb', line 28 def api_key_configured? !@api_key.to_s.empty? end |