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

Connects a Model to Gemini models hosted by Google Vertex AI.

It sends the same request content as the Gemini adapter to the configured Google Cloud project and location. A trusted credential resolver supplies each access token. Cancellation, deadlines, normalized streaming events, and ProviderError behavior match Providers::Gemini.

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, #embed, #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:



16
17
18
19
20
21
22
23
24
25
# File 'lib/little_ghost/providers/vertex_ai.rb', line 16

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