Class: OmniAI::Google::Config
- Inherits:
-
Config
- Object
- Config
- OmniAI::Google::Config
- 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"
Instance Attribute Summary collapse
- #location_id ⇒ String?
-
#locations ⇒ Hash{String => String}?
Vertex location per model, e.g.
- #project_id ⇒ String?
Instance Method Summary collapse
- #credentials ⇒ Google::Auth::ServiceAccountCredentials?
- #credentials=(value) ⇒ Object
-
#initialize(api_key: ENV.fetch("GOOGLE_API_KEY", nil), project_id: ENV.fetch("GOOGLE_PROJECT_ID", nil), location_id: ENV.fetch("GOOGLE_LOCATION_ID", nil), host: ENV.fetch("GOOGLE_HOST", DEFAULT_HOST), logger: nil, timeout: nil) ⇒ Config
constructor
A new instance of Config.
- #version ⇒ String
Constructor Details
#initialize(api_key: ENV.fetch("GOOGLE_API_KEY", nil), project_id: ENV.fetch("GOOGLE_PROJECT_ID", nil), location_id: ENV.fetch("GOOGLE_LOCATION_ID", nil), host: ENV.fetch("GOOGLE_HOST", DEFAULT_HOST), logger: nil, timeout: nil) ⇒ Config
Returns a new instance of Config.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/omniai/google/config.rb', line 35 def initialize( api_key: ENV.fetch("GOOGLE_API_KEY", nil), project_id: ENV.fetch("GOOGLE_PROJECT_ID", nil), location_id: ENV.fetch("GOOGLE_LOCATION_ID", nil), host: ENV.fetch("GOOGLE_HOST", DEFAULT_HOST), logger: nil, timeout: nil ) super(api_key:, host:, logger:, timeout:) @project_id = project_id @location_id = location_id end |
Instance Attribute Details
#location_id ⇒ String?
20 21 22 |
# File 'lib/omniai/google/config.rb', line 20 def location_id @location_id end |
#locations ⇒ Hash{String => String}?
Vertex location per model, e.g. { "gemini-3.8-flash" => "us" }. When set, each request derives its host
from the model's location, and a model missing from the map raises UnknownLocationError.
26 27 28 |
# File 'lib/omniai/google/config.rb', line 26 def locations @locations end |
#project_id ⇒ String?
16 17 18 |
# File 'lib/omniai/google/config.rb', line 16 def project_id @project_id end |
Instance Method Details
#credentials ⇒ Google::Auth::ServiceAccountCredentials?
54 55 56 57 58 |
# File 'lib/omniai/google/config.rb', line 54 def credentials return @credentials if defined?(@credentials) Credentials.detect end |
#credentials=(value) ⇒ Object
61 62 63 |
# File 'lib/omniai/google/config.rb', line 61 def credentials=(value) @credentials = Credentials.parse(value) end |
#version ⇒ String
49 50 51 |
# File 'lib/omniai/google/config.rb', line 49 def version @host.eql?(DEFAULT_HOST) ? Version::BETA : Version::STABLE end |