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.
-
#skill_sources ⇒ Hash?
Returns skill sources mapping.
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.
33 34 35 |
# File 'lib/skill_bench/config/store.rb', line 33 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 |
#skill_sources ⇒ Hash?
Returns skill sources mapping.
30 31 32 |
# File 'lib/skill_bench/config/store.rb', line 30 def skill_sources @skill_sources end |
Instance Method Details
#api_key ⇒ String?
Returns the API key for the current provider.
40 41 42 |
# File 'lib/skill_bench/config/store.rb', line 40 def api_key llm_providers_config.dig(current_llm_provider, :api_key) end |
#apply_provider_config(providers) ⇒ Hash
Applies provider-specific configuration values.
70 71 72 73 74 |
# File 'lib/skill_bench/config/store.rb', line 70 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.
108 109 110 |
# File 'lib/skill_bench/config/store.rb', line 108 def assign_allowed_commands(value) @allowed_commands = value end |
#assign_current_llm_provider(value) ⇒ Symbol?
Sets the current provider.
90 91 92 93 94 |
# File 'lib/skill_bench/config/store.rb', line 90 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.
100 101 102 |
# File 'lib/skill_bench/config/store.rb', line 100 def assign_max_execution_time(value) @max_execution_time = value end |
#base_url ⇒ String?
Returns the base URL for the current provider.
54 55 56 |
# File 'lib/skill_bench/config/store.rb', line 54 def base_url llm_providers_config.dig(current_llm_provider, :base_url) end |
#for_provider(provider) ⇒ Hash
Returns configuration for a specific provider.
62 63 64 |
# File 'lib/skill_bench/config/store.rb', line 62 def for_provider(provider) llm_providers_config[provider.to_sym] || {} end |
#model ⇒ String?
Returns the model for the current provider.
47 48 49 |
# File 'lib/skill_bench/config/store.rb', line 47 def model llm_providers_config.dig(current_llm_provider, :model) end |
#replace_provider_config(value) ⇒ Hash
Sets provider configuration.
116 117 118 |
# File 'lib/skill_bench/config/store.rb', line 116 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.
125 126 127 |
# File 'lib/skill_bench/config/store.rb', line 125 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.
170 171 172 |
# File 'lib/skill_bench/config/store.rb', line 170 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.
143 144 145 |
# File 'lib/skill_bench/config/store.rb', line 143 def set_provider_endpoint(provider, endpoint) provider_config(provider)[:endpoint] = endpoint end |
#set_provider_location(provider, location) ⇒ String
Sets location for a specific provider.
152 153 154 |
# File 'lib/skill_bench/config/store.rb', line 152 def set_provider_location(provider, location) provider_config(provider)[:location] = location end |
#set_provider_model(provider, model) ⇒ String
Sets model for a specific provider.
134 135 136 |
# File 'lib/skill_bench/config/store.rb', line 134 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.
161 162 163 |
# File 'lib/skill_bench/config/store.rb', line 161 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.
82 83 84 |
# File 'lib/skill_bench/config/store.rb', line 82 def set_provider_setting(provider, setting, value) provider_config(provider)[setting] = value end |