Class: Askcii::ConfigValidator
- Inherits:
-
Object
- Object
- Askcii::ConfigValidator
- Defined in:
- lib/askcii/config_validator.rb
Overview
Validates configuration settings before use
Constant Summary collapse
- VALID_PROVIDERS =
%w[openai anthropic gemini deepseek openrouter ollama].freeze
Class Method Summary collapse
-
.valid_provider?(name) ⇒ Boolean
Checks if a provider name is valid.
-
.valid_providers ⇒ Array<String>
Lists all valid provider names.
-
.validate!(config) ⇒ Hash
Validates a configuration hash.
Class Method Details
.valid_provider?(name) ⇒ Boolean
Checks if a provider name is valid
25 26 27 |
# File 'lib/askcii/config_validator.rb', line 25 def valid_provider?(name) VALID_PROVIDERS.include?(name.to_s.downcase) end |
.valid_providers ⇒ Array<String>
Lists all valid provider names
31 32 33 |
# File 'lib/askcii/config_validator.rb', line 31 def valid_providers VALID_PROVIDERS end |
.validate!(config) ⇒ Hash
Validates a configuration hash
13 14 15 16 17 18 19 20 |
# File 'lib/askcii/config_validator.rb', line 13 def validate!(config) validate_presence!(config) validate_provider!(config) validate_api_key!(config) validate_model_id!(config) validate_api_endpoint!(config) config end |