Class: ActiveGenie::Config::Providers::GoogleConfig
- Inherits:
-
ProviderBase
- Object
- ProviderBase
- ActiveGenie::Config::Providers::GoogleConfig
- Defined in:
- lib/active_genie/configs/providers/google_config.rb
Overview
Configuration class for the Google Generative Language API client. Manages API keys, 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 Google Generative Language 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 GENERATIVE_LANGUAGE_GOOGLE_API_KEY environment variable if not set.
14 15 16 |
# File 'lib/active_genie/configs/providers/google_config.rb', line 14 def api_key @api_key || ENV['GENERATIVE_LANGUAGE_GOOGLE_API_KEY'] || ENV.fetch('GEMINI_API_KEY', nil) end |
#api_url ⇒ String
Retrieves the base API URL for Google Generative Language API. Defaults to ‘generativelanguage.googleapis.com’.
21 22 23 24 25 |
# File 'lib/active_genie/configs/providers/google_config.rb', line 21 def api_url # NOTE: Google Generative Language API uses a specific path structure like /v1beta/models/{model}:generateContent # The base URL here should be just the domain part. @api_url || 'https://generativelanguage.googleapis.com' end |
#default_model ⇒ Object
27 28 29 |
# File 'lib/active_genie/configs/providers/google_config.rb', line 27 def default_model @default_model || 'gemini-2.5-flash' end |
#valid_model?(model) ⇒ Boolean
31 32 33 |
# File 'lib/active_genie/configs/providers/google_config.rb', line 31 def valid_model?(model) model.include?('gemini') end |