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.

Parameters:

  • provider (Symbol, String)

    provider identifier, coerced to a Symbol (e.g., :openai, :ollama)

  • options (Hash)

    override options that take precedence over the loaded provider config



19
20
21
22
23
# File 'lib/skill_bench/clients/provider_config.rb', line 19

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



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

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

Instance Method Details

#callHash

Loads and returns standardized provider configuration.

The resolved transport URLs (base_url and, for Azure, endpoint) are validated before being returned: they must be absolute http(s) URLs, and a credential is never sent over cleartext http to a non-loopback host.

Returns:

  • (Hash)

    Standardized configuration with api_key, model, base_url, etc.

Raises:



34
35
36
37
# File 'lib/skill_bench/clients/provider_config.rb', line 34

def call
  validate_transport_urls!
  standardized_config
end