Class: SkillBench::Clients::ProviderConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/clients/provider_config.rb

Overview

Service object to load and validate provider configuration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider, options) ⇒ ProviderConfig

Returns a new instance of ProviderConfig.



16
17
18
19
20
# File 'lib/skill_bench/clients/provider_config.rb', line 16

def initialize(provider, options)
  @provider = provider.to_sym
  @options = options
  @config = SkillBench::Config.for_provider(@provider) || {}
end

Class Method Details

.call(provider:, options: {}) ⇒ Hash

Returns standardized configuration.

Parameters:

  • provider (Symbol)

    provider identifier (e.g., :openai, :ollama)

  • options (Hash) (defaults to: {})

    override options

Returns:

  • (Hash)

    standardized configuration



12
13
14
# File 'lib/skill_bench/clients/provider_config.rb', line 12

def self.call(provider:, options: {})
  new(provider, options).call
end

Instance Method Details

#callHash

Loads and returns standardized provider configuration.

Returns:

  • (Hash)

    Standardized configuration with api_key, model, base_url, etc.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/skill_bench/clients/provider_config.rb', line 25

def call
  {
    api_key: fetch_config(:api_key),
    model: fetch_config(:model),
    base_url: fetch_config(:base_url),
    request_path: fetch_config(:request_path),
    provider_name: @provider.to_s.capitalize,
    # Provider-specific extras (nil when not present)
    endpoint: fetch_config(:endpoint),
    location: fetch_config(:location),
    project_id: fetch_config(:project_id),
    api_version: fetch_config(:api_version)
  }
end