Add Vertex AI support

This commit is contained in:
2026-03-02 16:20:57 +00:00
parent 2188e3cba8
commit 38d44f104a
5 changed files with 58 additions and 11 deletions

View File

@@ -60,7 +60,8 @@ func NewRegistry(entries map[string]config.ProviderEntry, models []config.ModelE
}
func buildProvider(entry config.ProviderEntry) (Provider, error) {
if entry.APIKey == "" {
// Vertex AI doesn't require APIKey, so check for it separately
if entry.Type != "vertexai" && entry.APIKey == "" {
return nil, nil
}
@@ -97,6 +98,14 @@ func buildProvider(entry config.ProviderEntry) (Provider, error) {
APIKey: entry.APIKey,
Endpoint: entry.Endpoint,
}), nil
case "vertexai":
if entry.Project == "" || entry.Location == "" {
return nil, fmt.Errorf("project and location are required for vertexai")
}
return googleprovider.NewVertexAI(config.VertexAIConfig{
Project: entry.Project,
Location: entry.Location,
}), nil
default:
return nil, fmt.Errorf("unknown provider type %q", entry.Type)
}