Visitar URL original
set default for vertexai · opencode-ai/opencode@bbe710c · GitHub
Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit bbe710c

Browse files
committed
set default for vertexai
1 parent 3a8f497 commit bbe710c

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎internal/config/config.go‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ func setProviderDefaults() {
322322
viper.SetDefault("agents.title.model", models.AzureGPT41Mini)
323323
return
324324
}
325+
326+
// Google Cloud VertexAI configuration
327+
if hasVertexAICredentials() {
328+
viper.SetDefault("agents.coder.model", models.VertexAIGemini25)
329+
viper.SetDefault("agents.task.model", models.VertexAIGemini25Flash)
330+
viper.SetDefault("agents.title.model", models.VertexAIGemini25Flash)
331+
return
332+
}
325333
}
326334

327335
// hasAWSCredentials checks if AWS credentials are available in the environment.
@@ -350,6 +358,19 @@ func hasAWSCredentials() bool {
350358
return false
351359
}
352360

361+
// hasVertexAICredentials checks if VertexAI credentials are available in the environment.
362+
func hasVertexAICredentials() bool {
363+
// Check for explicit VertexAI parameters
364+
if os.Getenv("VERTEXAI_PROJECT") != "" || os.Getenv("VERTEXAI_LOCATION") != "" {
365+
return true
366+
}
367+
// Check for Google Cloud project and location
368+
if os.Getenv("GOOGLE_CLOUD_PROJECT") != "" && (os.Getenv("GOOGLE_CLOUD_REGION") != "" && os.Getenv("GOOGLE_CLOUD_LOCATION") != "") {
369+
return true
370+
}
371+
return false
372+
}
373+
353374
// readConfig handles the result of reading a configuration file.
354375
func readConfig(err error) error {
355376
if err == nil {

0 commit comments

Comments
 (0)