Class: GenerateImage::Configuration
- Inherits:
-
Object
- Object
- GenerateImage::Configuration
- Defined in:
- lib/generate_image/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#default_output_format ⇒ Object
Returns the value of attribute default_output_format.
-
#default_quality ⇒ Object
Returns the value of attribute default_quality.
-
#default_size ⇒ Object
Returns the value of attribute default_size.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #resolved_api_key ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generate_image/configuration.rb', line 8 def initialize @api_key = nil @default_model = "gpt-image-1" @base_url = "https://api.openai.com" @default_size = "1024x1024" @default_quality = "auto" @default_output_format = "png" @open_timeout = 30 @read_timeout = 120 @max_retries = 1 end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def base_url @base_url end |
#default_model ⇒ Object
Returns the value of attribute default_model.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def default_model @default_model end |
#default_output_format ⇒ Object
Returns the value of attribute default_output_format.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def default_output_format @default_output_format end |
#default_quality ⇒ Object
Returns the value of attribute default_quality.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def default_quality @default_quality end |
#default_size ⇒ Object
Returns the value of attribute default_size.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def default_size @default_size end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def max_retries @max_retries end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
5 6 7 |
# File 'lib/generate_image/configuration.rb', line 5 def read_timeout @read_timeout end |
Instance Method Details
#resolved_api_key ⇒ Object
20 21 22 23 24 25 |
# File 'lib/generate_image/configuration.rb', line 20 def resolved_api_key [api_key, ENV["OPENAI_API_KEY"], ENV["DALL_E_API_KEY"]] .compact .map(&:to_s) .find { |s| !s.strip.empty? } end |