Class: LittleGhost::Providers::VertexAI

Inherits:
Gemini
  • Object
show all
Defined in:
lib/little_ghost/providers/vertex_ai.rb,
lib/little_ghost/providers/vertex_ai/credential_resolver.rb

Overview

Google Vertex AI variant of the Gemini wire protocol.

Defined Under Namespace

Classes: CredentialResolver

Constant Summary

Constants inherited from Gemini

Gemini::DEFAULT_BASE_URL

Instance Attribute Summary

Attributes inherited from Gemini

#model

Instance Method Summary collapse

Methods inherited from Gemini

#capabilities, request_options, #stream

Methods inherited from Base

#capabilities, #prepare_request, request_options, #stream

Constructor Details

#initialize(model:, project:, location: "global", access_token: nil, credential_resolver: nil, base_url: nil, **arguments) ⇒ VertexAI

Creates a Vertex AI client for a Google Cloud project and location.

Raises:



11
12
13
14
15
16
17
18
19
20
# File 'lib/little_ghost/providers/vertex_ai.rb', line 11

def initialize(model:, project:, location: "global", access_token: nil, credential_resolver: nil,
  base_url: nil, **arguments)
  @project = project.to_s
  @location = location.to_s
  @credential_resolver = credential_resolver || CredentialResolver.new(access_token:)
  raise ConfigurationError, "Vertex AI project is required" if @project.empty?

  base_url ||= "https://#{@location}-aiplatform.googleapis.com/v1/"
  super(api_key: "unused", model:, base_url:, **arguments)
end