1package provider
2
3import (
4 "context"
5 "os"
6
7 "github.com/charmbracelet/crush/internal/logging"
8 "google.golang.org/genai"
9)
10
11type VertexAIClient ProviderClient
12
13func newVertexAIClient(opts providerClientOptions) VertexAIClient {
14 client, err := genai.NewClient(context.Background(), &genai.ClientConfig{
15 Project: os.Getenv("GOOGLE_CLOUD_PROJECT"),
16 Location: os.Getenv("GOOGLE_CLOUD_LOCATION"),
17 Backend: genai.BackendVertexAI,
18 })
19 if err != nil {
20 logging.Error("Failed to create VertexAI client", "error", err)
21 return nil
22 }
23
24 return &geminiClient{
25 providerOptions: opts,
26 client: client,
27 }
28}