Class: ActiveGenie::Config::Providers::OpenaiConfig
- Inherits:
-
ProviderBase
- Object
- ProviderBase
- ActiveGenie::Config::Providers::OpenaiConfig
- Defined in:
- lib/active_genie/configs/providers/openai_config.rb
Overview
Configuration class for the OpenAI API client. Manages API keys, organization IDs, URLs, model selections, and client instantiation.
Instance Attribute Summary
Attributes inherited from ProviderBase
Instance Method Summary collapse
-
#api_key ⇒ String?
Retrieves the API key.
-
#api_url ⇒ String
Retrieves the base API URL for OpenAI API.
- #default_model ⇒ Object
- #valid_model?(model) ⇒ Boolean
Methods inherited from ProviderBase
Constructor Details
This class inherits a constructor from ActiveGenie::Config::Providers::ProviderBase
Instance Method Details
#api_key ⇒ String?
Retrieves the API key. Falls back to the OPENAI_API_KEY environment variable if not set.
14 15 16 |
# File 'lib/active_genie/configs/providers/openai_config.rb', line 14 def api_key @api_key || ENV.fetch('OPENAI_API_KEY', nil) end |
#api_url ⇒ String
Retrieves the base API URL for OpenAI API. Defaults to ‘api.openai.com/v1’.
21 22 23 |
# File 'lib/active_genie/configs/providers/openai_config.rb', line 21 def api_url @api_url || 'https://api.openai.com/v1' end |
#default_model ⇒ Object
25 26 27 |
# File 'lib/active_genie/configs/providers/openai_config.rb', line 25 def default_model @default_model || 'gpt-5-mini' end |
#valid_model?(model) ⇒ Boolean
29 30 31 |
# File 'lib/active_genie/configs/providers/openai_config.rb', line 29 def valid_model?(model) model.include?('gpt') end |