Class: GeminiCraft::Configuration
- Inherits:
-
Object
- Object
- GeminiCraft::Configuration
- Defined in:
- lib/gemini_craft/configuration.rb
Overview
Configuration for the GeminiCraft gem
Instance Attribute Summary collapse
-
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#connection_pool_size ⇒ Object
Returns the value of attribute connection_pool_size.
-
#keep_alive_timeout ⇒ Object
Returns the value of attribute keep_alive_timeout.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#model ⇒ Object
Returns the value of attribute model.
-
#streaming_enabled ⇒ Object
Returns the value of attribute streaming_enabled.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initialize a new configuration with default values.
-
#validate! ⇒ Object
Validate that the configuration has required parameters.
Constructor Details
#initialize ⇒ Configuration
Initialize a new configuration with default values
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gemini_craft/configuration.rb', line 10 def initialize @api_key = ENV.fetch("GEMINI_API_KEY", nil) @api_base_url = "https://generativelanguage.googleapis.com/v1beta" @model = "gemini-2.0-flash" @timeout = 30 @cache_enabled = false @cache_ttl = 3600 # 1 hour in seconds @max_retries = 3 @logger = nil @log_level = :info @streaming_enabled = false @connection_pool_size = 5 @keep_alive_timeout = 30 end |
Instance Attribute Details
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def api_base_url @api_base_url end |
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def api_key @api_key end |
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def cache_enabled @cache_enabled end |
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def cache_ttl @cache_ttl end |
#connection_pool_size ⇒ Object
Returns the value of attribute connection_pool_size.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def connection_pool_size @connection_pool_size end |
#keep_alive_timeout ⇒ Object
Returns the value of attribute keep_alive_timeout.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def keep_alive_timeout @keep_alive_timeout end |
#log_level ⇒ Object
Returns the value of attribute log_level.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def logger @logger end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def max_retries @max_retries end |
#model ⇒ Object
Returns the value of attribute model.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def model @model end |
#streaming_enabled ⇒ Object
Returns the value of attribute streaming_enabled.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def streaming_enabled @streaming_enabled end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/gemini_craft/configuration.rb', line 6 def timeout @timeout end |
Instance Method Details
#validate! ⇒ Object
Validate that the configuration has required parameters
27 28 29 30 31 32 33 |
# File 'lib/gemini_craft/configuration.rb', line 27 def validate! raise ConfigurationError, "API key must be configured" unless api_key raise ConfigurationError, "Model must be configured" unless model validate_log_level! validate_timeouts! end |