Class: SkillBench::Models::Config
- Inherits:
-
Object
- Object
- SkillBench::Models::Config
- Defined in:
- lib/skill_bench/models/config.rb
Overview
Represents the skill-bench configuration loaded from skill-bench.json
Class Method Summary collapse
-
.load(path = 'skill-bench.json') ⇒ SkillBench::Models::Config
Load configuration from a JSON file.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Config
constructor
A new instance of Config.
-
#max_execution_time ⇒ Integer
Returns max execution time.
-
#provider_config ⇒ Hash
Returns the provider configuration.
-
#provider_name ⇒ String?
Returns the configured provider name.
-
#to_provider ⇒ SkillBench::Models::Provider
Builds a Provider model from the current configuration.
Constructor Details
#initialize(data = {}) ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 |
# File 'lib/skill_bench/models/config.rb', line 12 def initialize(data = {}) raise ArgumentError, 'Config-data must be a Hash' unless data.is_a?(Hash) @data = data end |
Class Method Details
.load(path = 'skill-bench.json') ⇒ SkillBench::Models::Config
Load configuration from a JSON file
22 23 24 25 |
# File 'lib/skill_bench/models/config.rb', line 22 def self.load(path = 'skill-bench.json') raw_data = JSON.parse(File.read(path), symbolize_names: true) new(raw_data) end |
Instance Method Details
#max_execution_time ⇒ Integer
Returns max execution time
41 42 43 |
# File 'lib/skill_bench/models/config.rb', line 41 def max_execution_time @data[:max_execution_time] || 30 end |
#provider_config ⇒ Hash
Returns the provider configuration
35 36 37 |
# File 'lib/skill_bench/models/config.rb', line 35 def provider_config @data[:config] || {} end |
#provider_name ⇒ String?
Returns the configured provider name
29 30 31 |
# File 'lib/skill_bench/models/config.rb', line 29 def provider_name @data[:provider] end |
#to_provider ⇒ SkillBench::Models::Provider
Builds a Provider model from the current configuration. Returns a mock provider if provider name is ‘mock’.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/skill_bench/models/config.rb', line 49 def to_provider return nil if provider_name.nil? || provider_name == 'mock' Provider.new( name: provider_name, runtime: provider_name, llm: provider_name, config: provider_config ) end |