Repository navigation
docs: propose merging VertexAI into GoogleAI(enterprise=...) - #7246
huangjeff5 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This proposal outlines merging the VertexAI plugin into GoogleAI to allow switching between AI Studio and Google Cloud backends via an enterprise configuration. The review feedback points out several important considerations: a discrepancy in how Go handles GOOGLE_API_KEY for Express Mode, the potential need to support both backends simultaneously in a single application for hybrid use cases, and a correction regarding the SDK's environment variable name (GOOGLE_GENAI_USE_VERTEXAI instead of GOOGLE_GENAI_USE_ENTERPRISE).
| - **`enterprise=True`:** | ||
| - `project`: the argument, then `GCLOUD_PROJECT` / `GOOGLE_CLOUD_PROJECT`, then `credentials.project_id`, then the ADC project. | ||
| - `location`: the argument, then `GOOGLE_CLOUD_LOCATION` / `GCLOUD_LOCATION`, then `us-central1`. Multi-regions keep their dedicated endpoints. | ||
| - Express mode only with an explicit `api_key=`. Environment keys stay ignored, as they are today, so an AI Studio `GEMINI_API_KEY` never quietly becomes a Cloud key. |
There was a problem hiding this comment.
In Go, the VertexAI plugin's vertexAPIKeyFromEnv helper currently checks GOOGLE_API_KEY (which is also checked by GoogleAI for AI Studio). This means GOOGLE_API_KEY is not ignored for Express Mode in Go today. If GoogleAI(enterprise=True) is called without an explicit key, it might accidentally pick up GOOGLE_API_KEY from the environment and run in Express Mode on Vertex AI, which contradicts the statement that environment keys stay ignored. We should clarify how GOOGLE_API_KEY will be handled in Go to prevent accidental backend/billing switches.
|
|
||
| ## What we give up at 2.0 | ||
|
|
||
| - **Both backends in one app.** Until 2.0, `GoogleAI()` plus `VertexAI()` keeps working. After 2.0, two `GoogleAI` plugins collide on `googleai/`, and the registry raises at startup. We'd make that message name the fix. I expect this is rare, but we have no usage data. |
There was a problem hiding this comment.
Preventing both backends from being registered in the same application after 2.0 might block valid hybrid or transition use cases. For example, a team might want to use AI Studio (GoogleAI with enterprise=False) for low-cost/fast prototyping or non-sensitive tasks, while using Vertex AI (GoogleAI with enterprise=True) for production/sensitive tasks within the same service. We should consider supporting named plugin instances or a per-request backend override to allow both backends to coexist if needed.
|
|
||
| 1. **Is `enterprise` the long-term name?** The flag follows "Gemini Enterprise Agent Platform", a brand developer marketing has already moved away from. Can we confirm with the `google-genai` team, and is JS `@google/genai` moving too? | ||
| 2. **Flag name in Genkit:** mirror each SDK (`enterprise=` in Python, a backend enum in Go), or use one brand-neutral `backend=` Literal everywhere? | ||
| 3. **The environment variable:** should `GoogleAI()` honor `GOOGLE_GENAI_USE_ENTERPRISE` when `enterprise=` isn't passed? Honoring it lets deployment config switch the backend without code changes. Ignoring it avoids a switch caused by a variable set for some other tool. An explicit `enterprise=` wins either way. I lean toward honoring it and logging the chosen backend once. |
There was a problem hiding this comment.
Please double-check the environment variable name used by the official google-genai SDK. The SDK typically uses GOOGLE_GENAI_USE_VERTEXAI rather than GOOGLE_GENAI_USE_ENTERPRISE to trigger the Vertex AI backend. Genkit should align with the exact environment variable name used by the underlying SDK to avoid confusion and double-configuration.
|
moving this to genkit-python: genkit-ai/genkit-python#138 |
Adds a cross-SDK proposal at
docs/proposals/merge-vertexai-into-googleai.md: fold theVertexAIplugin intoGoogleAIbehind anenterprise=switch, so moving from an AI Studio key to a Google Cloud project is one line of setup instead of rewriting everygoogleai/...ref tovertexai/....What it proposes
GoogleAIgetsenterprise=,projectandlocation.VertexAIkeeps working and logs a deprecation warning. Nothing breaks.VertexAI. Oldvertexai/...refs keep resolving through an alias that only resolves whenenterprise=True, so a ref never quietly moves to a different billing account. This needs a small core addition (plugins claiming legacy namespaces).genai.ClientforgenerateContent, the plugin's own Interactions client) pick the backend from the same setting. The doc asks that the Cloud Interactions client take the backend as a value, not infer it from the plugin class.Why now
google-genai2.14+ takesClient(enterprise=True)and documentsvertexai=as legacy. Gogenaiv1.57 addedBackendEnterprise. Both readGOOGLE_GENAI_USE_ENTERPRISE.GoogleAIholds up better than a plugin class named after the product.Decisions requested
GoogleAIplugin with a backend switch, andVertexAIdeprecated now and removed at 2.0.enterprise=/BackendEnterprise), or use a brand-neutralbackend=everywhere. Ideally confirmed with thegoogle-genaiteam.GoogleAI()honorsGOOGLE_GENAI_USE_ENTERPRISEwhenenterprise=isn't passed.Docs only; no code changes. Related: genkit-python#137 (Model Garden package rename, independent of this proposal).