Class: SkillBench::Config::Store
- Inherits:
-
Object
- Object
- SkillBench::Config::Store
- Defined in:
- lib/skill_bench/config/store.rb
Overview
Holds mutable evaluator configuration state behind the Config facade.
Instance Attribute Summary collapse
-
#allowed_commands ⇒ Array<String>?
Returns the allowed command list.
-
#current_llm_provider ⇒ Symbol?
Returns the current provider name.
-
#llm_providers_config ⇒ Hash?
Returns provider configuration.
-
#max_execution_time ⇒ Integer?
readonly
Returns the maximum command execution time.
Instance Method Summary collapse
-
#api_key ⇒ String?
Returns the API key for the current provider.
-
#apply_provider_config(providers) ⇒ Hash
Applies provider-specific configuration values.
-
#assign_allowed_commands(value) ⇒ Array<String>?
Sets allowed commands.
-
#assign_current_llm_provider(value) ⇒ Symbol?
Sets the current provider.
-
#assign_max_execution_time(value) ⇒ Integer
Sets maximum command execution time.
-
#base_url ⇒ String?
Returns the base URL for the current provider.
-
#for_provider(provider) ⇒ Hash
Returns configuration for a specific provider.
-
#initialize ⇒ Store
constructor
Initializes a new configuration store with empty provider settings.
-
#model ⇒ String?
Returns the model for the current provider.
-
#replace_provider_config(value) ⇒ Hash
Sets provider configuration.
-
#set_provider_api_key(provider, api_key) ⇒ String
Sets API key for a specific provider.
-
#set_provider_base_url(provider, base_url) ⇒ String
Sets base_url for a specific provider.
-
#set_provider_endpoint(provider, endpoint) ⇒ String
Sets endpoint for a specific provider.
-
#set_provider_location(provider, location) ⇒ String
Sets location for a specific provider.
-
#set_provider_model(provider, model) ⇒ String
Sets model for a specific provider.
-
#set_provider_project_id(provider, project_id) ⇒ String
Sets project_id for a specific provider.
-
#set_provider_setting(provider, setting, value) ⇒ Object
Sets one provider-specific configuration value.
Constructor Details
#initialize ⇒ Store
Initializes a new configuration store with empty provider settings.
28 29 30 |
# File 'lib/skill_bench/config/store.rb', line 28 def initialize @llm_providers_config = {} end |
Instance Attribute Details
#allowed_commands ⇒ Array<String>?
Returns the allowed command list.
20 21 22 |
# File 'lib/skill_bench/config/store.rb', line 20 def allowed_commands @allowed_commands end |
#current_llm_provider ⇒ Symbol?
Returns the current provider name.
10 11 12 |
# File 'lib/skill_bench/config/store.rb', line 10 def current_llm_provider @current_llm_provider end |
#llm_providers_config ⇒ Hash?
Returns provider configuration.
25 26 27 |
# File 'lib/skill_bench/config/store.rb', line 25 def llm_providers_config @llm_providers_config end |
#max_execution_time ⇒ Integer? (readonly)
Returns the maximum command execution time.
15 16 17 |
# File 'lib/skill_bench/config/store.rb', line 15 def max_execution_time @max_execution_time end |
Instance Method Details
#api_key ⇒ String?
Returns the API key for the current provider.
35 36 37 |
# File 'lib/skill_bench/config/store.rb', line 35 def api_key llm_providers_config.dig(current_llm_provider, :api_key) end |
#apply_provider_config(providers) ⇒ Hash
Applies provider-specific configuration values.
65 66 67 68 69 |
# File 'lib/skill_bench/config/store.rb', line 65 def apply_provider_config(providers) providers.each do |provider, config| provider_config(provider).merge!(config) end end |
#assign_allowed_commands(value) ⇒ Array<String>?
Sets allowed commands.
103 104 105 |
# File 'lib/skill_bench/config/store.rb', line 103 def assign_allowed_commands(value) @allowed_commands = value end |
#assign_current_llm_provider(value) ⇒ Symbol?
Sets the current provider.
85 86 87 88 89 |
# File 'lib/skill_bench/config/store.rb', line 85 def assign_current_llm_provider(value) stripped = value.to_s.strip @current_llm_provider = stripped.empty? ? nil : stripped.to_sym @current_llm_provider end |
#assign_max_execution_time(value) ⇒ Integer
Sets maximum command execution time.
95 96 97 |
# File 'lib/skill_bench/config/store.rb', line 95 def assign_max_execution_time(value) @max_execution_time = value end |
#base_url ⇒ String?
Returns the base URL for the current provider.
49 50 51 |
# File 'lib/skill_bench/config/store.rb', line 49 def base_url llm_providers_config.dig(current_llm_provider, :base_url) end |
#for_provider(provider) ⇒ Hash
Returns configuration for a specific provider.
57 58 59 |
# File 'lib/skill_bench/config/store.rb', line 57 def for_provider(provider) llm_providers_config[provider.to_sym] || {} end |
#model ⇒ String?
Returns the model for the current provider.
42 43 44 |
# File 'lib/skill_bench/config/store.rb', line 42 def model llm_providers_config.dig(current_llm_provider, :model) end |
#replace_provider_config(value) ⇒ Hash
Sets provider configuration.
111 112 113 |
# File 'lib/skill_bench/config/store.rb', line 111 def replace_provider_config(value) @llm_providers_config = value end |
#set_provider_api_key(provider, api_key) ⇒ String
Sets API key for a specific provider.
120 121 122 |
# File 'lib/skill_bench/config/store.rb', line 120 def set_provider_api_key(provider, api_key) provider_config(provider)[:api_key] = api_key end |
#set_provider_base_url(provider, base_url) ⇒ String
Sets base_url for a specific provider.
165 166 167 |
# File 'lib/skill_bench/config/store.rb', line 165 def set_provider_base_url(provider, base_url) provider_config(provider)[:base_url] = base_url end |
#set_provider_endpoint(provider, endpoint) ⇒ String
Sets endpoint for a specific provider.
138 139 140 |
# File 'lib/skill_bench/config/store.rb', line 138 def set_provider_endpoint(provider, endpoint) provider_config(provider)[:endpoint] = endpoint end |
#set_provider_location(provider, location) ⇒ String
Sets location for a specific provider.
147 148 149 |
# File 'lib/skill_bench/config/store.rb', line 147 def set_provider_location(provider, location) provider_config(provider)[:location] = location end |
#set_provider_model(provider, model) ⇒ String
Sets model for a specific provider.
129 130 131 |
# File 'lib/skill_bench/config/store.rb', line 129 def set_provider_model(provider, model) provider_config(provider)[:model] = model end |
#set_provider_project_id(provider, project_id) ⇒ String
Sets project_id for a specific provider.
156 157 158 |
# File 'lib/skill_bench/config/store.rb', line 156 def set_provider_project_id(provider, project_id) provider_config(provider)[:project_id] = project_id end |
#set_provider_setting(provider, setting, value) ⇒ Object
Sets one provider-specific configuration value.
77 78 79 |
# File 'lib/skill_bench/config/store.rb', line 77 def set_provider_setting(provider, setting, value) provider_config(provider)[setting] = value end |