fix(ai): support GOOGLE_CLOUD_API_KEY for google-vertex (#1948) (#1976)

This commit is contained in:
Gordon Hui
2026-03-09 20:30:22 +08:00
committed by GitHub
parent d9cfa115be
commit 01f7faae9c
4 changed files with 51 additions and 12 deletions

View File

@@ -380,6 +380,7 @@ describe("Generate E2E Tests", () => {
describe("Google Vertex Provider (gemini-3-flash-preview)", () => {
const vertexProject = process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT;
const vertexLocation = process.env.GOOGLE_CLOUD_LOCATION;
const vertexApiKey = process.env.GOOGLE_CLOUD_API_KEY;
const isVertexConfigured = Boolean(vertexProject && vertexLocation);
const vertexOptions = { project: vertexProject, location: vertexLocation } as const;
const llm = getModel("google-vertex", "gemini-3-flash-preview");
@@ -388,6 +389,10 @@ describe("Generate E2E Tests", () => {
await basicTextGeneration(llm, vertexOptions);
});
it.skipIf(!vertexApiKey)("should complete basic text generation with Vertex API key", { retry: 3 }, async () => {
await basicTextGeneration(llm, { apiKey: vertexApiKey! });
});
it.skipIf(!isVertexConfigured)("should handle tool calling", { retry: 3 }, async () => {
await handleToolCall(llm, vertexOptions);
});