Class: OmniAI::Google::Config

Inherits:
Config
  • Object
show all
Defined in:
lib/omniai/google/config.rb

Overview

Configuration for Google.

Defined Under Namespace

Modules: Version

Constant Summary collapse

DEFAULT_HOST =
'https://generativelanguage.googleapis.com'
DEFAULT_VERSION =
Version::BETA

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: ENV.fetch('GOOGLE_API_KEY', nil), host: ENV.fetch('GOOGLE_HOST', DEFAULT_HOST), version: ENV.fetch('GOOGLE_VERSION', DEFAULT_VERSION), logger: nil, timeout: nil) ⇒ Config

Returns a new instance of Config.

Parameters:

  • api_key (String, nil) (defaults to: ENV.fetch('GOOGLE_API_KEY', nil))

    optional - defaults to ‘ENV`

  • host (String, nil) (defaults to: ENV.fetch('GOOGLE_HOST', DEFAULT_HOST))

    optional - defaults to ‘ENV w/ fallback to `DEFAULT_HOST`

  • version (String, nil) (defaults to: ENV.fetch('GOOGLE_VERSION', DEFAULT_VERSION))

    optional - defaults to ‘ENV w/ fallback to `DEFAULT_VERSION`

  • logger (Logger, nil) (defaults to: nil)

    optional - defaults to

  • timeout (Integer, Hash, nil) (defaults to: nil)

    optional



24
25
26
27
28
29
30
31
32
33
# File 'lib/omniai/google/config.rb', line 24

def initialize(
  api_key: ENV.fetch('GOOGLE_API_KEY', nil),
  host: ENV.fetch('GOOGLE_HOST', DEFAULT_HOST),
  version: ENV.fetch('GOOGLE_VERSION', DEFAULT_VERSION),
  logger: nil,
  timeout: nil
)
  super(api_key:, host:, logger:, timeout:)
  @version = version
end

Instance Attribute Details

#versionString?

Returns:

  • (String, nil)


17
18
19
# File 'lib/omniai/google/config.rb', line 17

def version
  @version
end