From ecee62482f2548a84d02fa55753cd0ea7a677486 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 17 Nov 2026 13:27:58 -0600 Subject: [PATCH 1/3] refactor(py)!: rename genkit-vertexai to genkit-model-garden --- .github/workflows/publish_python.yml | 2 +- bin/bump_version | 2 +- mkdocs.yml | 2 +- .../LICENSE | 0 .../README.md | 22 ++++-- .../pyproject.toml | 11 +-- .../src/genkit_model_garden}/__init__.py | 17 ++--- .../src/genkit_model_garden}/_anthropic.py | 6 +- .../src/genkit_model_garden}/_client.py | 2 +- .../src/genkit_model_garden}/_constants.py | 4 +- .../src/genkit_model_garden}/_model_info.py | 2 +- .../src/genkit_model_garden}/_plugin.py | 34 ++++----- .../src/genkit_model_garden}/_secrets.py | 0 .../src/genkit_model_garden}/py.typed | 0 .../tests}/anthropic_generate_test.py | 2 +- .../tests}/client_test.py | 4 +- .../tests}/conftest.py | 2 +- .../tests}/model_garden_test.py | 44 ++++++------ .../tests}/secrets_test.py | 8 +-- packages/genkit/pyproject.toml | 7 +- pyproject.toml | 10 +-- scripts/check_consistency.py | 2 +- tests/config_field_guard_test.py | 2 +- tests/version_bounds_guard_test.py | 43 ++++++----- uv.lock | 72 +++++++++---------- 25 files changed, 155 insertions(+), 145 deletions(-) rename packages/{genkit-vertexai => genkit-model-garden}/LICENSE (100%) rename packages/{genkit-vertexai => genkit-model-garden}/README.md (60%) rename packages/{genkit-vertexai => genkit-model-garden}/pyproject.toml (93%) rename packages/{genkit-vertexai/src/genkit_vertexai => genkit-model-garden/src/genkit_model_garden}/__init__.py (70%) rename packages/{genkit-vertexai/src/genkit_vertexai/_model_garden => genkit-model-garden/src/genkit_model_garden}/_anthropic.py (94%) rename packages/{genkit-vertexai/src/genkit_vertexai/_model_garden => genkit-model-garden/src/genkit_model_garden}/_client.py (99%) rename packages/{genkit-vertexai/src/genkit_vertexai => genkit-model-garden/src/genkit_model_garden}/_constants.py (86%) rename packages/{genkit-vertexai/src/genkit_vertexai/_model_garden => genkit-model-garden/src/genkit_model_garden}/_model_info.py (96%) rename packages/{genkit-vertexai/src/genkit_vertexai/_model_garden => genkit-model-garden/src/genkit_model_garden}/_plugin.py (94%) rename packages/{genkit-vertexai/src/genkit_vertexai/_model_garden => genkit-model-garden/src/genkit_model_garden}/_secrets.py (100%) rename packages/{genkit-vertexai/src/genkit_vertexai => genkit-model-garden/src/genkit_model_garden}/py.typed (100%) rename packages/{genkit-vertexai/tests/model_garden => genkit-model-garden/tests}/anthropic_generate_test.py (97%) rename packages/{genkit-vertexai/tests/model_garden => genkit-model-garden/tests}/client_test.py (96%) rename packages/{genkit-vertexai/tests/model_garden => genkit-model-garden/tests}/conftest.py (95%) rename packages/{genkit-vertexai/tests/model_garden => genkit-model-garden/tests}/model_garden_test.py (93%) rename packages/{genkit-vertexai/tests/model_garden => genkit-model-garden/tests}/secrets_test.py (93%) diff --git a/.github/workflows/publish_python.yml b/.github/workflows/publish_python.yml index 43db4547f..cfdb9dca6 100644 --- a/.github/workflows/publish_python.yml +++ b/.github/workflows/publish_python.yml @@ -69,10 +69,10 @@ jobs: packages/genkit-google-genai packages/genkit-mcp packages/genkit-middleware + packages/genkit-model-garden packages/genkit-ollama packages/genkit-openai packages/genkit-otel - packages/genkit-vertexai ) FAILED=() diff --git a/bin/bump_version b/bin/bump_version index fb61097a1..37ed6a277 100755 --- a/bin/bump_version +++ b/bin/bump_version @@ -176,7 +176,7 @@ fi # sed expressions applied to every pyproject.toml: # - the version line -# - exact intra-repo pins (e.g. genkit-openai==X.Y.Z in genkit-vertexai's extras) +# - exact intra-repo pins (e.g. genkit-openai==X.Y.Z in genkit-model-garden's extras) # - capped intra-repo ranges: floor moves to $NEW_VERSION and major cap moves # to max(2, major + 1), except 0.x-only specs explicitly capped at <1 (such # as genkit-evaluators), which keep <1 while on 0.x. diff --git a/mkdocs.yml b/mkdocs.yml index a0b3e4986..f9eef5c22 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,10 +23,10 @@ plugins: - packages/genkit-google-genai/src - packages/genkit-mcp/src - packages/genkit-middleware/src + - packages/genkit-model-garden/src - packages/genkit-ollama/src - packages/genkit-openai/src - packages/genkit-otel/src - - packages/genkit-vertexai/src options: docstring_style: google annotations_path: full diff --git a/packages/genkit-vertexai/LICENSE b/packages/genkit-model-garden/LICENSE similarity index 100% rename from packages/genkit-vertexai/LICENSE rename to packages/genkit-model-garden/LICENSE diff --git a/packages/genkit-vertexai/README.md b/packages/genkit-model-garden/README.md similarity index 60% rename from packages/genkit-vertexai/README.md rename to packages/genkit-model-garden/README.md index 5dc22347f..abe5ba6dd 100644 --- a/packages/genkit-vertexai/README.md +++ b/packages/genkit-model-garden/README.md @@ -1,6 +1,16 @@ -# Genkit Vertex AI Plugin +# Genkit Model Garden Plugin -Integrate Genkit with Google Cloud Vertex AI Model Garden. +Call Claude, Llama, Mistral and other third-party models hosted in Google Cloud +[Model Garden](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/model-garden/explore-models). +Requests run on your Google Cloud project's credentials and billing, so you +don't need a separate Anthropic or Meta account. + +Gemini isn't in this package. For Gemini on Google Cloud, use `VertexAI` from +[`genkit-google-genai`](https://github.com/genkit-ai/genkit-python/tree/main/packages/genkit-google-genai). + +This package was published as `genkit-vertexai` through 0.13. Only the package +and import names changed; the `ModelGarden` class and `modelgarden/` model +names are the same. > **Building with a coding agent? Install the Genkit Python skill first.** > @@ -17,9 +27,9 @@ Integrate Genkit with Google Cloud Vertex AI Model Garden. Install the extra for the Model Garden publishers you call: ```bash -uv add 'genkit-vertexai[anthropic]' # Claude -uv add 'genkit-vertexai[openai]' # Llama, Mistral, and other OpenAI-compatible models -uv add 'genkit-vertexai[anthropic,openai]' # both +uv add 'genkit-model-garden[anthropic]' # Claude +uv add 'genkit-model-garden[openai]' # Llama, Mistral, and other OpenAI-compatible models +uv add 'genkit-model-garden[anthropic,openai]' # both ``` The package without an extra serves no models. Calling a model without its @@ -29,7 +39,7 @@ extra raises an error naming the command to run. ```python from genkit import Genkit -from genkit_vertexai import ModelGarden +from genkit_model_garden import ModelGarden ai = Genkit( plugins=[ModelGarden(project='my-project', location='us-central1')], diff --git a/packages/genkit-vertexai/pyproject.toml b/packages/genkit-model-garden/pyproject.toml similarity index 93% rename from packages/genkit-vertexai/pyproject.toml rename to packages/genkit-model-garden/pyproject.toml index 77837ed44..99241bd50 100644 --- a/packages/genkit-vertexai/pyproject.toml +++ b/packages/genkit-model-garden/pyproject.toml @@ -47,14 +47,17 @@ dependencies = [ "genkit>=0.13.0,<2", "google-auth[requests]>=2.14.1", ] -description = "Vertex AI and Model Garden on Genkit" +description = "Claude, Llama, and Mistral on Genkit through Google Cloud Model Garden" keywords = [ "genkit", - "vertex-ai", "model-garden", + "google-cloud", + "vertex-ai", + "claude", + "llama", ] license = "Apache-2.0" -name = "genkit-vertexai" +name = "genkit-model-garden" readme = "README.md" requires-python = ">=3.10" version = "0.13.0" @@ -77,5 +80,5 @@ build-backend = "hatchling.build" requires = ["hatchling"] [tool.hatch.build.targets.wheel] -only-include = ["src/genkit_vertexai"] +only-include = ["src/genkit_model_garden"] sources = ["src"] diff --git a/packages/genkit-vertexai/src/genkit_vertexai/__init__.py b/packages/genkit-model-garden/src/genkit_model_garden/__init__.py similarity index 70% rename from packages/genkit-vertexai/src/genkit_vertexai/__init__.py rename to packages/genkit-model-garden/src/genkit_model_garden/__init__.py index 4fe118edf..d5f5a96f9 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/__init__.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/__init__.py @@ -14,15 +14,16 @@ # # SPDX-License-Identifier: Apache-2.0 -"""Vertex AI Plugin for Genkit. +"""Model Garden plugin for Genkit. -This plugin provides integration with Google Cloud's Vertex AI platform, -including Model Garden for accessing third-party models. +Calls third-party models hosted in Google Cloud Model Garden (Claude, Llama, +Mistral) on your Google Cloud project's credentials and billing. Gemini is not +in this package; it's ``VertexAI`` in ``genkit-google-genai``. Example: ```python from genkit import Genkit - from genkit_vertexai import ModelGarden + from genkit_model_garden import ModelGarden # 1. Initialize Genkit with the Model Garden plugin ai = Genkit( @@ -49,14 +50,14 @@ async def main() -> None: Requirements: - Uses Google Cloud Application Default Credentials (ADC); there is no explicit-credentials option. - - Claude models need ``genkit-vertexai[anthropic]``; Llama, Mistral, and other - OpenAI-compatible models need ``genkit-vertexai[openai]``. + - Claude models need ``genkit-model-garden[anthropic]``; Llama, Mistral, and other + OpenAI-compatible models need ``genkit-model-garden[openai]``. See Also: - - Vertex AI Model Garden: https://cloud.google.com/vertex-ai/docs/model-garden + - Model Garden: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/model-garden/explore-models """ -from genkit_vertexai._model_garden._plugin import ModelGarden +from genkit_model_garden._plugin import ModelGarden __all__ = [ 'ModelGarden', diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_anthropic.py b/packages/genkit-model-garden/src/genkit_model_garden/_anthropic.py similarity index 94% rename from packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_anthropic.py rename to packages/genkit-model-garden/src/genkit_model_garden/_anthropic.py index 66a1756dc..71f2f3261 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_anthropic.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_anthropic.py @@ -24,19 +24,19 @@ from genkit_anthropic import AnthropicConfig # Private import across packages, on purpose. genkit-anthropic and -# genkit-vertexai release in lockstep, so Model Garden reuses the Claude +# genkit-model-garden release in lockstep, so Model Garden reuses the Claude # model class instead of copying it. from genkit_anthropic._model_info import get_model_info as get_anthropic_model_info from genkit_anthropic._models import AnthropicModel -from genkit_vertexai._model_garden._secrets import reject_secrets_api_key from genkit import ModelResponse from genkit.model import ModelConfig, ModelContext, ModelInfo, ModelRequest, ModelSupports from genkit.plugin_api import loop_local_client +from genkit_model_garden._secrets import reject_secrets_api_key class AnthropicModelGarden: - """Manages integration with Anthropic models on Vertex AI Model Garden.""" + """Manages integration with Anthropic models on Model Garden.""" def __init__( self, diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_client.py b/packages/genkit-model-garden/src/genkit_model_garden/_client.py similarity index 99% rename from packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_client.py rename to packages/genkit-model-garden/src/genkit_model_garden/_client.py index bb06e040b..c7b71bc8a 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_client.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_client.py @@ -15,7 +15,7 @@ # SPDX-License-Identifier: Apache-2.0 -"""Vertex AI client. +"""Model Garden OpenAI-compatible client. Provides an async factory for creating AsyncOpenAI clients authenticated with Google Cloud credentials. Credential refresh is performed off the diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_constants.py b/packages/genkit-model-garden/src/genkit_model_garden/_constants.py similarity index 86% rename from packages/genkit-vertexai/src/genkit_vertexai/_constants.py rename to packages/genkit-model-garden/src/genkit_model_garden/_constants.py index 42c402d99..8698cf5c4 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/_constants.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_constants.py @@ -14,9 +14,9 @@ # # SPDX-License-Identifier: Apache-2.0 -"""Constants used by the Vertex AI plugin. +"""Constants used by the Model Garden plugin. -This module defines constants used throughout the Vertex AI plugin, +This module defines constants used throughout the Model Garden plugin, including environment variable names and configuration values. """ diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_model_info.py b/packages/genkit-model-garden/src/genkit_model_garden/_model_info.py similarity index 96% rename from packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_model_info.py rename to packages/genkit-model-garden/src/genkit_model_garden/_model_info.py index 0bcc06603..1388d5f2a 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_model_info.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_model_info.py @@ -14,7 +14,7 @@ # # SPDX-License-Identifier: Apache-2.0 -"""Catalog of OpenAI-compatible models served by Vertex AI Model Garden.""" +"""Catalog of OpenAI-compatible models served by Model Garden.""" from genkit.model import ModelInfo, ModelSupports diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_plugin.py b/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py similarity index 94% rename from packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_plugin.py rename to packages/genkit-model-garden/src/genkit_model_garden/_plugin.py index 0198ba73a..d587a2799 100644 --- a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_plugin.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py @@ -28,29 +28,30 @@ from dataclasses import dataclass from typing import TYPE_CHECKING -from genkit_vertexai import _constants as const -from genkit_vertexai._model_garden._model_info import ( - SUPPORTED_OPENAI_COMPAT_MODELS, - get_default_model_info, -) -from genkit_vertexai._model_garden._secrets import reject_secrets_api_key from google.auth import default as google_auth_default from google.auth.exceptions import DefaultCredentialsError from genkit import GenkitError, ModelResponse from genkit.model import Model, ModelContext, ModelInfo, ModelRequest from genkit.plugin_api import Action, ActionKind, Plugin, loop_local_client +from genkit_model_garden import _constants as const +from genkit_model_garden._model_info import ( + SUPPORTED_OPENAI_COMPAT_MODELS, + get_default_model_info, +) +from genkit_model_garden._secrets import reject_secrets_api_key if TYPE_CHECKING: - from genkit_vertexai._model_garden._client import CachedOpenAI from openai import AsyncOpenAI + from genkit_model_garden._client import CachedOpenAI + MODELGARDEN_PLUGIN_NAME = 'modelgarden' @dataclass(frozen=True) class _Extra: - """An optional publisher dependency of genkit-vertexai. + """An optional publisher dependency of genkit-model-garden. Attributes: packages: Top-level packages the extra installs. A missing extra fails @@ -67,13 +68,13 @@ class _Extra: # only installs the SDK for the models it actually calls. _ANTHROPIC_EXTRA = _Extra( packages=frozenset({'anthropic', 'genkit_anthropic'}), - missing_message="Model Garden Claude models need the anthropic extra: uv add 'genkit-vertexai[anthropic]'", + missing_message="Model Garden Claude models need the anthropic extra: uv add 'genkit-model-garden[anthropic]'", ) _OPENAI_EXTRA = _Extra( packages=frozenset({'openai', 'genkit_openai'}), missing_message=( 'Model Garden Llama, Mistral, and other OpenAI-compatible models need the openai extra: ' - "uv add 'genkit-vertexai[openai]'" + "uv add 'genkit-model-garden[openai]'" ), ) @@ -146,7 +147,7 @@ def __init__( @loop_local_client def _runtime_client(self) -> 'CachedOpenAI': # _client.py imports openai, which is an extra; load it on first generate. - from genkit_vertexai._model_garden._client import CachedOpenAI + from genkit_model_garden._client import CachedOpenAI return CachedOpenAI(location=self._location, project=self._project) @@ -204,10 +205,11 @@ async def _generate(request: ModelRequest, ctx: ModelContext) -> ModelResponse: class ModelGarden(Plugin): """Model Garden plugin for Genkit. - This plugin provides integration with Google Cloud's Vertex AI platform, - enabling the use of Vertex AI models and services within the Genkit - framework. It handles initialization of the Model Garden client and - registration of model actions. + Serves third-party models (Claude, Llama, Mistral) hosted in Google Cloud + Model Garden, billed to your Google Cloud project. It handles + initialization of the Model Garden client and registration of model + actions. Gemini is not served here; use ``VertexAI`` from + ``genkit-google-genai``. """ name = MODELGARDEN_PLUGIN_NAME @@ -295,7 +297,7 @@ async def _location_and_project(self, name: str) -> tuple[str, str]: return self.model_locations.get(name, self.location), self.project async def _create_model_action(self, name: str) -> Action: - """Create an Action object for a Model Garden Vertex AI model. + """Create an Action object for a Model Garden model. The publisher's extra is checked before the project ID, so a missing extra is the first error reported. diff --git a/packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_secrets.py b/packages/genkit-model-garden/src/genkit_model_garden/_secrets.py similarity index 100% rename from packages/genkit-vertexai/src/genkit_vertexai/_model_garden/_secrets.py rename to packages/genkit-model-garden/src/genkit_model_garden/_secrets.py diff --git a/packages/genkit-vertexai/src/genkit_vertexai/py.typed b/packages/genkit-model-garden/src/genkit_model_garden/py.typed similarity index 100% rename from packages/genkit-vertexai/src/genkit_vertexai/py.typed rename to packages/genkit-model-garden/src/genkit_model_garden/py.typed diff --git a/packages/genkit-vertexai/tests/model_garden/anthropic_generate_test.py b/packages/genkit-model-garden/tests/anthropic_generate_test.py similarity index 97% rename from packages/genkit-vertexai/tests/model_garden/anthropic_generate_test.py rename to packages/genkit-model-garden/tests/anthropic_generate_test.py index d0cbb7f67..f8534d99b 100644 --- a/packages/genkit-vertexai/tests/model_garden/anthropic_generate_test.py +++ b/packages/genkit-model-garden/tests/anthropic_generate_test.py @@ -18,7 +18,7 @@ import httpx import pytest -from genkit_vertexai import ModelGarden +from genkit_model_garden import ModelGarden from genkit import FinishReason, Genkit diff --git a/packages/genkit-vertexai/tests/model_garden/client_test.py b/packages/genkit-model-garden/tests/client_test.py similarity index 96% rename from packages/genkit-vertexai/tests/model_garden/client_test.py rename to packages/genkit-model-garden/tests/client_test.py index 7e8d9dc90..e3939d436 100644 --- a/packages/genkit-vertexai/tests/model_garden/client_test.py +++ b/packages/genkit-model-garden/tests/client_test.py @@ -19,7 +19,7 @@ from unittest.mock import MagicMock, patch import pytest -from genkit_vertexai._model_garden._client import CachedOpenAI +from genkit_model_garden._client import CachedOpenAI from google.auth.exceptions import DefaultCredentialsError, RefreshError, TransportError from genkit import GenkitError @@ -47,7 +47,7 @@ async def test_client_targets_resolved_project( """The OpenAI base_url points at project=, or the ADC project when none is passed.""" with ( patch('google.auth.default', _adc('adc-proj')), - patch('genkit_vertexai._model_garden._client._AsyncOpenAI') as openai_cls, + patch('genkit_model_garden._client._AsyncOpenAI') as openai_cls, ): await CachedOpenAI(location='us-central1', project=explicit).get() diff --git a/packages/genkit-vertexai/tests/model_garden/conftest.py b/packages/genkit-model-garden/tests/conftest.py similarity index 95% rename from packages/genkit-vertexai/tests/model_garden/conftest.py rename to packages/genkit-model-garden/tests/conftest.py index c6d8c008f..53c61c12b 100644 --- a/packages/genkit-vertexai/tests/model_garden/conftest.py +++ b/packages/genkit-model-garden/tests/conftest.py @@ -57,5 +57,5 @@ def client(**kwargs: Any) -> AsyncAnthropicVertex: http_client = httpx.AsyncClient(transport=httpx.MockTransport(fake.handler)) return AsyncAnthropicVertex(access_token='google-token', http_client=http_client, **kwargs) - with patch('genkit_vertexai._model_garden._anthropic.AsyncAnthropicVertex', client): + with patch('genkit_model_garden._anthropic.AsyncAnthropicVertex', client): yield fake.requests diff --git a/packages/genkit-vertexai/tests/model_garden/model_garden_test.py b/packages/genkit-model-garden/tests/model_garden_test.py similarity index 93% rename from packages/genkit-vertexai/tests/model_garden/model_garden_test.py rename to packages/genkit-model-garden/tests/model_garden_test.py index 98dd7f6ec..ee8773a42 100644 --- a/packages/genkit-vertexai/tests/model_garden/model_garden_test.py +++ b/packages/genkit-model-garden/tests/model_garden_test.py @@ -28,11 +28,11 @@ import pytest from anthropic import AsyncAnthropicVertex from genkit_anthropic import AnthropicConfig +from genkit_model_garden import ModelGarden +from genkit_model_garden._anthropic import AnthropicModelGarden +from genkit_model_garden._model_info import DEFAULT_SUPPORTS, SUPPORTED_OPENAI_COMPAT_MODELS +from genkit_model_garden._plugin import ModelGardenModel from genkit_openai import OpenAIConfig -from genkit_vertexai import ModelGarden -from genkit_vertexai._model_garden._anthropic import AnthropicModelGarden -from genkit_vertexai._model_garden._model_info import DEFAULT_SUPPORTS, SUPPORTED_OPENAI_COMPAT_MODELS -from genkit_vertexai._model_garden._plugin import ModelGardenModel from google.auth.exceptions import DefaultCredentialsError from openai.types.chat import ChatCompletion @@ -41,14 +41,14 @@ from genkit.plugin_api import ActionKind CLAUDE = 'modelgarden/anthropic/claude-sonnet-4@20250514' -_ADC = 'genkit_vertexai._model_garden._plugin.google_auth_default' +_ADC = 'genkit_model_garden._plugin.google_auth_default' LLAMA = 'modelgarden/meta/llama-3.1-405b-instruct-maas' MISTRAL = 'modelgarden/mistralai/mistral-small-2503' -CLAUDE_EXTRA_MISSING = "Model Garden Claude models need the anthropic extra: uv add 'genkit-vertexai[anthropic]'" +CLAUDE_EXTRA_MISSING = "Model Garden Claude models need the anthropic extra: uv add 'genkit-model-garden[anthropic]'" OPENAI_EXTRA_MISSING = ( 'Model Garden Llama, Mistral, and other OpenAI-compatible models need the openai extra: ' - "uv add 'genkit-vertexai[openai]'" + "uv add 'genkit-model-garden[openai]'" ) @@ -155,7 +155,7 @@ async def test_generate_model_garden_claude_drops_part_with_only_signature_key() reply.usage = MagicMock(input_tokens=1, output_tokens=1) reply.stop_reason = 'end_turn' - with patch('genkit_vertexai._model_garden._anthropic.AsyncAnthropicVertex') as client_ctor: + with patch('genkit_model_garden._anthropic.AsyncAnthropicVertex') as client_ctor: client = client_ctor.return_value client.messages.create = AsyncMock(return_value=reply) client.beta.messages.create = AsyncMock(return_value=reply) @@ -249,7 +249,7 @@ async def test_model_garden_openai_compatible_model_resolves_and_generates() -> client.chat.completions.create = AsyncMock(return_value=_chat_completion('hello from llama')) with patch( - 'genkit_vertexai._model_garden._plugin.ModelGardenModel.create_client', + 'genkit_model_garden._plugin.ModelGardenModel.create_client', new=AsyncMock(return_value=client), ): ai = Genkit(plugins=[ModelGarden(project='my-project', location='us-central1')]) @@ -291,9 +291,9 @@ def make_client(**kwargs: object) -> MagicMock: return client with ( - patch('genkit_vertexai._model_garden._client.auth.default', return_value=(creds, 'my-project')), - patch('genkit_vertexai._model_garden._client.google.auth.transport.requests.Request'), - patch('genkit_vertexai._model_garden._client._AsyncOpenAI', side_effect=make_client), + patch('genkit_model_garden._client.auth.default', return_value=(creds, 'my-project')), + patch('genkit_model_garden._client.google.auth.transport.requests.Request'), + patch('genkit_model_garden._client._AsyncOpenAI', side_effect=make_client), ): ai = Genkit(plugins=[ModelGarden(project='my-project', location='us-central1')]) for _ in range(3): @@ -318,9 +318,9 @@ def make_client(**kwargs: object) -> MagicMock: return client with ( - patch('genkit_vertexai._model_garden._client.auth.default', return_value=(creds, 'my-project')), - patch('genkit_vertexai._model_garden._client.google.auth.transport.requests.Request'), - patch('genkit_vertexai._model_garden._client._AsyncOpenAI', side_effect=make_client), + patch('genkit_model_garden._client.auth.default', return_value=(creds, 'my-project')), + patch('genkit_model_garden._client.google.auth.transport.requests.Request'), + patch('genkit_model_garden._client._AsyncOpenAI', side_effect=make_client), ): ai = Genkit(plugins=[ModelGarden(project='my-project', location='us-central1')]) first = await ai.generate(model='modelgarden/meta/llama-3.1-405b-instruct-maas', prompt='hi') @@ -349,7 +349,7 @@ async def test_generate_model_garden_claude_registers_full_publisher_path() -> N client.beta = MagicMock() client.messages.create = AsyncMock(return_value=reply) client.beta.messages.create = AsyncMock(return_value=reply) - with patch('genkit_vertexai._model_garden._anthropic.AsyncAnthropicVertex', return_value=client): + with patch('genkit_model_garden._anthropic.AsyncAnthropicVertex', return_value=client): ai = Genkit(plugins=[ModelGarden(project='p', location='us-central1')]) response = await ai.generate(model=claude, prompt='hi') action = await ai.lookup_model(claude) @@ -368,15 +368,15 @@ def _uninstall(monkeypatch: pytest.MonkeyPatch, *modules: str) -> None: module_table = cast(dict[str, ModuleType | None], sys.modules) for module in modules: monkeypatch.setitem(module_table, module, None) - monkeypatch.delitem(sys.modules, 'genkit_vertexai._model_garden._anthropic', raising=False) + monkeypatch.delitem(sys.modules, 'genkit_model_garden._anthropic', raising=False) -def test_import_genkit_vertexai_does_not_load_publisher_sdks() -> None: - """`import genkit_vertexai` and `ModelGarden()` leave the Anthropic and OpenAI SDKs and plugins unloaded.""" +def test_import_genkit_model_garden_does_not_load_publisher_sdks() -> None: + """`import genkit_model_garden` and `ModelGarden()` leave the Anthropic and OpenAI SDKs and plugins unloaded.""" code = textwrap.dedent(""" import json, sys - import genkit_vertexai - from genkit_vertexai import ModelGarden + import genkit_model_garden + from genkit_model_garden import ModelGarden ModelGarden(project='my-project') publishers = ('anthropic', 'genkit_anthropic', 'openai', 'genkit_openai') print(json.dumps(sorted(m for m in publishers if m in sys.modules))) @@ -592,7 +592,7 @@ async def test_model_garden_without_models_still_resolves_any_model() -> None: client.chat.completions.create = AsyncMock(return_value=_chat_completion('hello from mistral')) with patch( - 'genkit_vertexai._model_garden._plugin.ModelGardenModel.create_client', + 'genkit_model_garden._plugin.ModelGardenModel.create_client', new=AsyncMock(return_value=client), ): ai = Genkit(plugins=[ModelGarden(project='p', location='us-central1')]) diff --git a/packages/genkit-vertexai/tests/model_garden/secrets_test.py b/packages/genkit-model-garden/tests/secrets_test.py similarity index 93% rename from packages/genkit-vertexai/tests/model_garden/secrets_test.py rename to packages/genkit-model-garden/tests/secrets_test.py index 4e4c28962..f5c0c056f 100644 --- a/packages/genkit-vertexai/tests/model_garden/secrets_test.py +++ b/packages/genkit-model-garden/tests/secrets_test.py @@ -21,9 +21,9 @@ from unittest.mock import AsyncMock, patch import pytest -from genkit_vertexai import ModelGarden -from genkit_vertexai._model_garden._plugin import ModelGardenModel -from genkit_vertexai._model_garden._secrets import reject_secrets_api_key +from genkit_model_garden import ModelGarden +from genkit_model_garden._plugin import ModelGardenModel +from genkit_model_garden._secrets import reject_secrets_api_key from genkit import Genkit, GenkitError, Message, ModelResponse, Part, Role from genkit.model import ModelContext, ModelRequest @@ -44,7 +44,7 @@ async def test_generate_model_garden_claude_secrets_api_key_fails_invalid_argume """A key slot in `context.secrets` on Model Garden Claude fails with INVALID_ARGUMENT and never builds a client.""" ai = model_garden_app() - with patch('genkit_vertexai._model_garden._anthropic.AsyncAnthropicVertex') as vertex_client: + with patch('genkit_model_garden._anthropic.AsyncAnthropicVertex') as vertex_client: response = await ai.generate(model=CLAUDE_MODEL, prompt='hi', context={'secrets': {key_name: key_value}}) assert response.error is not None diff --git a/packages/genkit/pyproject.toml b/packages/genkit/pyproject.toml index f914272c5..237c1991e 100644 --- a/packages/genkit/pyproject.toml +++ b/packages/genkit/pyproject.toml @@ -84,11 +84,10 @@ google-cloud = ["genkit-google-cloud>=0.13.0,<2"] google-genai = ["genkit-google-genai>=0.13.0,<2"] mcp = ["genkit-mcp>=0.13.0,<2"] middleware = ["genkit-middleware>=0.13.0,<2"] +model-garden = ["genkit-model-garden[anthropic,openai]>=0.13.0,<2"] otel = ["genkit-otel>=0.13.0,<2"] ollama = ["genkit-ollama>=0.13.0,<2"] openai = ["genkit-openai>=0.13.0,<2"] -vertex-ai = ["genkit-vertexai[anthropic,openai]>=0.13.0,<2"] -vertexai = ["genkit-vertexai[anthropic,openai]>=0.13.0,<2"] [project.urls] "Bug Tracker" = "https://github.com/genkit-ai/genkit-python/issues" @@ -114,10 +113,10 @@ DEP002 = [ "genkit-google-genai", "genkit-mcp", "genkit-middleware", + "genkit-model-garden", "genkit-ollama", "genkit-openai", "genkit-otel", - "genkit-vertexai", ] # Standard library on Python 3.14+; imported behind a version check. DEP001 = ["annotationlib"] @@ -137,7 +136,7 @@ genkit-google-cloud = { workspace = true } genkit-google-genai = { workspace = true } genkit-mcp = { workspace = true } genkit-middleware = { workspace = true } +genkit-model-garden = { workspace = true } genkit-otel = { workspace = true } genkit-ollama = { workspace = true } genkit-openai = { workspace = true } -genkit-vertexai = { workspace = true } diff --git a/pyproject.toml b/pyproject.toml index aba4cf25f..fa04f1a43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "genkit-otel", "genkit-a2ui", "genkit-ollama", - "genkit-vertexai", + "genkit-model-garden", ] description = "Workspace for Genkit packages" license = "Apache-2.0" @@ -181,7 +181,7 @@ genkit-middleware = { workspace = true } genkit-otel = { workspace = true } genkit-a2ui = { workspace = true } genkit-ollama = { workspace = true } -genkit-vertexai = { workspace = true } +genkit-model-garden = { workspace = true } [tool.uv.workspace] exclude = ["*/shared"] @@ -416,7 +416,7 @@ root = [ "packages/genkit-otel/src", "packages/genkit-a2ui/src", "packages/genkit-ollama/src", - "packages/genkit-vertexai/src", + "packages/genkit-model-garden/src", ".", # For samples.shared and other root-level imports ] @@ -454,7 +454,7 @@ extraPaths = [ "packages/genkit-otel/src", "packages/genkit-a2ui/src", "packages/genkit-ollama/src", - "packages/genkit-vertexai/src", + "packages/genkit-model-garden/src", ] pythonVersion = "3.10" reportMissingImports = true @@ -504,7 +504,7 @@ search-path = [ "packages/genkit-otel/src", "packages/genkit-a2ui/src", "packages/genkit-ollama/src", - "packages/genkit-vertexai/src", + "packages/genkit-model-garden/src", ".", ] python_version = "3.10" diff --git a/scripts/check_consistency.py b/scripts/check_consistency.py index 2855dff4d..363d5f25c 100755 --- a/scripts/check_consistency.py +++ b/scripts/check_consistency.py @@ -144,7 +144,7 @@ def _check_intra_repo_spec( dep_name = m_name.group(1) - # Exact intra-repo pins (e.g. genkit-vertexai extras importing private sibling modules). + # Exact intra-repo pins (e.g. genkit-model-garden extras importing private sibling modules). if section.startswith('optional-dependencies.'): m_pin = _EXACT_PIN_RE.match(spec) if m_pin: diff --git a/tests/config_field_guard_test.py b/tests/config_field_guard_test.py index a56327622..7152a9186 100644 --- a/tests/config_field_guard_test.py +++ b/tests/config_field_guard_test.py @@ -46,7 +46,7 @@ 'genkit_google_genai', 'genkit_ollama', 'genkit_openai', - 'genkit_vertexai', + 'genkit_model_garden', ) COMMON_FIELDS = frozenset(name for name in ModelConfig.model_fields if name != 'extra') diff --git a/tests/version_bounds_guard_test.py b/tests/version_bounds_guard_test.py index 5fb9eae7a..fd132f304 100644 --- a/tests/version_bounds_guard_test.py +++ b/tests/version_bounds_guard_test.py @@ -89,8 +89,7 @@ def _make_workspace_fixture(py_root: Path, version: str = '0.12.0', *, include_e cap = consistency.expected_major_cap(version) extras: dict[str, list[str]] = { 'openai': [f'genkit-openai>={version},<{cap}'], - 'vertex-ai': [f'genkit-vertexai[anthropic,openai]>={version},<{cap}'], - 'vertexai': [f'genkit-vertexai[anthropic,openai]>={version},<{cap}'], + 'model-garden': [f'genkit-model-garden[anthropic,openai]>={version},<{cap}'], } if include_evaluators: extras['evaluators'] = [f'genkit-evaluators>={version},<1'] @@ -116,7 +115,7 @@ def _make_workspace_fixture(py_root: Path, version: str = '0.12.0', *, include_e ) _write_pkg( py_root, - 'genkit-vertexai', + 'genkit-model-garden', version, dependencies=[f'genkit>={version},<{cap}'], optional_dependencies={ @@ -161,9 +160,8 @@ def test_real_workspace_passes_consistency_and_extras_contract() -> None: core_version = genkit_project['version'] opt_deps = genkit_project['optional-dependencies'] - # Both vertex-ai and vertexai aliases resolve to the same bounded target. - assert opt_deps['vertex-ai'] == [f'genkit-vertexai[anthropic,openai]>={core_version},<2'] - assert opt_deps['vertexai'] == [f'genkit-vertexai[anthropic,openai]>={core_version},<2'] + # The model-garden extra pulls in both publisher extras under the same bounded target. + assert opt_deps['model-garden'] == [f'genkit-model-garden[anthropic,openai]>={core_version},<2'] if 'evaluators' in opt_deps: assert opt_deps['evaluators'] == [f'genkit-evaluators>={core_version},<1'] @@ -193,7 +191,7 @@ def test_bump_transition_0_12_0_to_0_13_0_rolls_floors_and_preserves_lt1(tmp_pat genkit_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit' / 'pyproject.toml'))['project'] assert genkit_proj['version'] == '0.13.0' assert genkit_proj['optional-dependencies']['openai'] == ['genkit-openai>=0.13.0,<2'] - assert genkit_proj['optional-dependencies']['vertexai'] == ['genkit-vertexai[anthropic,openai]>=0.13.0,<2'] + assert genkit_proj['optional-dependencies']['model-garden'] == ['genkit-model-garden[anthropic,openai]>=0.13.0,<2'] assert genkit_proj['optional-dependencies']['evaluators'] == ['genkit-evaluators>=0.13.0,<1'] openai_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-openai' / 'pyproject.toml'))['project'] @@ -204,10 +202,10 @@ def test_bump_transition_0_12_0_to_0_13_0_rolls_floors_and_preserves_lt1(tmp_pat ] assert evals_proj['dependencies'] == ['genkit>=0.13.0,<1', 'jsonata-python>=0.6.0'] - vertex_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-vertexai' / 'pyproject.toml'))[ + garden_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-model-garden' / 'pyproject.toml'))[ 'project' ] - assert vertex_proj['optional-dependencies']['openai'] == ['genkit-openai==0.13.0'] + assert garden_proj['optional-dependencies']['openai'] == ['genkit-openai==0.13.0'] def test_bump_transition_0_13_0_to_1_0_0_keeps_lt2_cap(tmp_path: Path) -> None: @@ -220,16 +218,15 @@ def test_bump_transition_0_13_0_to_1_0_0_keeps_lt2_cap(tmp_path: Path) -> None: genkit_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit' / 'pyproject.toml'))['project'] assert genkit_proj['version'] == '1.0.0' assert genkit_proj['optional-dependencies']['openai'] == ['genkit-openai>=1.0.0,<2'] - assert genkit_proj['optional-dependencies']['vertex-ai'] == ['genkit-vertexai[anthropic,openai]>=1.0.0,<2'] - assert genkit_proj['optional-dependencies']['vertexai'] == ['genkit-vertexai[anthropic,openai]>=1.0.0,<2'] + assert genkit_proj['optional-dependencies']['model-garden'] == ['genkit-model-garden[anthropic,openai]>=1.0.0,<2'] openai_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-openai' / 'pyproject.toml'))['project'] assert openai_proj['dependencies'] == ['genkit>=1.0.0,<2', 'openai>=1.60.0,<3'] - vertex_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-vertexai' / 'pyproject.toml'))[ + garden_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-model-garden' / 'pyproject.toml'))[ 'project' ] - assert vertex_proj['optional-dependencies']['anthropic'] == ['genkit-anthropic==1.0.0'] + assert garden_proj['optional-dependencies']['anthropic'] == ['genkit-anthropic==1.0.0'] @pytest.mark.parametrize('start_version', ['1.0.0', '1.2.0']) @@ -243,15 +240,15 @@ def test_bump_transition_1_x_to_2_0_0_advances_cap_to_lt3(tmp_path: Path, start_ genkit_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit' / 'pyproject.toml'))['project'] assert genkit_proj['version'] == '2.0.0' assert genkit_proj['optional-dependencies']['openai'] == ['genkit-openai>=2.0.0,<3'] - assert genkit_proj['optional-dependencies']['vertexai'] == ['genkit-vertexai[anthropic,openai]>=2.0.0,<3'] + assert genkit_proj['optional-dependencies']['model-garden'] == ['genkit-model-garden[anthropic,openai]>=2.0.0,<3'] openai_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-openai' / 'pyproject.toml'))['project'] assert openai_proj['dependencies'] == ['genkit>=2.0.0,<3', 'openai>=1.60.0,<3'] - vertex_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-vertexai' / 'pyproject.toml'))[ + garden_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-model-garden' / 'pyproject.toml'))[ 'project' ] - assert vertex_proj['optional-dependencies']['openai'] == ['genkit-openai==2.0.0'] + assert garden_proj['optional-dependencies']['openai'] == ['genkit-openai==2.0.0'] def test_bump_transition_multi_digit_major_9_to_10(tmp_path: Path) -> None: @@ -329,7 +326,7 @@ def test_consistency_rejects_unbounded_extra_and_stale_exact_pin(tmp_path: Path) ) _write_pkg( tmp_path, - 'genkit-vertexai', + 'genkit-model-garden', '0.12.0', dependencies=['genkit>=0.12.0,<2'], optional_dependencies={'openai': ['genkit-openai==0.11.0']}, @@ -362,15 +359,17 @@ def test_bump_transition_0_13_0_to_rc_moves_every_intra_repo_bound(tmp_path: Pat genkit_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit' / 'pyproject.toml'))['project'] assert genkit_proj['version'] == '1.0.0-rc.1' - assert genkit_proj['optional-dependencies']['vertexai'] == ['genkit-vertexai[anthropic,openai]>=1.0.0-rc.1,<2'] + assert genkit_proj['optional-dependencies']['model-garden'] == [ + 'genkit-model-garden[anthropic,openai]>=1.0.0-rc.1,<2' + ] openai_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-openai' / 'pyproject.toml'))['project'] assert openai_proj['dependencies'] == ['genkit>=1.0.0-rc.1,<2', 'openai>=1.60.0,<3'] - vertex_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-vertexai' / 'pyproject.toml'))[ + garden_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-model-garden' / 'pyproject.toml'))[ 'project' ] - assert vertex_proj['optional-dependencies']['anthropic'] == ['genkit-anthropic==1.0.0-rc.1'] + assert garden_proj['optional-dependencies']['anthropic'] == ['genkit-anthropic==1.0.0-rc.1'] def test_rc_bump_with_unretired_zero_x_package_fails_consistency(tmp_path: Path) -> None: @@ -439,10 +438,10 @@ def test_bump_transition_rc_to_next_rc_and_stable(tmp_path: Path) -> None: openai_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-openai' / 'pyproject.toml'))['project'] assert openai_proj['dependencies'] == ['genkit>=1.0.0,<2', 'openai>=1.60.0,<3'] - vertex_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-vertexai' / 'pyproject.toml'))[ + garden_proj = consistency.load_pyproject(str(tmp_path / 'packages' / 'genkit-model-garden' / 'pyproject.toml'))[ 'project' ] - assert vertex_proj['optional-dependencies']['openai'] == ['genkit-openai==1.0.0'] + assert garden_proj['optional-dependencies']['openai'] == ['genkit-openai==1.0.0'] def test_release_rc_workflow_runs_bump_version_and_consistency_before_push() -> None: diff --git a/uv.lock b/uv.lock index dd3c40cd0..880df03a1 100644 --- a/uv.lock +++ b/uv.lock @@ -32,10 +32,10 @@ members = [ "genkit-google-genai", "genkit-mcp", "genkit-middleware", + "genkit-model-garden", "genkit-ollama", "genkit-openai", "genkit-otel", - "genkit-vertexai", "genkit-workspace", "google-genai-deep-research", "google-genai-media", @@ -1598,6 +1598,9 @@ mcp = [ middleware = [ { name = "genkit-middleware" }, ] +model-garden = [ + { name = "genkit-model-garden", extra = ["anthropic", "openai"] }, +] ollama = [ { name = "genkit-ollama" }, ] @@ -1607,12 +1610,6 @@ openai = [ otel = [ { name = "genkit-otel" }, ] -vertex-ai = [ - { name = "genkit-vertexai", extra = ["anthropic", "openai"] }, -] -vertexai = [ - { name = "genkit-vertexai", extra = ["anthropic", "openai"] }, -] [package.metadata] requires-dist = [ @@ -1628,11 +1625,10 @@ requires-dist = [ { name = "genkit-google-genai", marker = "extra == 'google-genai'", editable = "packages/genkit-google-genai" }, { name = "genkit-mcp", marker = "extra == 'mcp'", editable = "packages/genkit-mcp" }, { name = "genkit-middleware", marker = "extra == 'middleware'", editable = "packages/genkit-middleware" }, + { name = "genkit-model-garden", extras = ["anthropic", "openai"], marker = "extra == 'model-garden'", editable = "packages/genkit-model-garden" }, { name = "genkit-ollama", marker = "extra == 'ollama'", editable = "packages/genkit-ollama" }, { name = "genkit-openai", marker = "extra == 'openai'", editable = "packages/genkit-openai" }, { name = "genkit-otel", marker = "extra == 'otel'", editable = "packages/genkit-otel" }, - { name = "genkit-vertexai", extras = ["anthropic", "openai"], marker = "extra == 'vertex-ai'", editable = "packages/genkit-vertexai" }, - { name = "genkit-vertexai", extras = ["anthropic", "openai"], marker = "extra == 'vertexai'", editable = "packages/genkit-vertexai" }, { name = "httpx", specifier = ">=0.28.1" }, { name = "json5", specifier = ">=0.10.0" }, { name = "jsonschema", specifier = ">=4.23.0" }, @@ -1646,7 +1642,7 @@ requires-dist = [ { name = "uvloop", marker = "sys_platform != 'win32'", specifier = ">=0.21.0" }, { name = "websockets", specifier = ">=13.0.0" }, ] -provides-extras = ["a2ui", "amazon-bedrock", "anthropic", "django", "fastapi", "flask", "google-cloud", "google-genai", "mcp", "middleware", "otel", "ollama", "openai", "vertex-ai", "vertexai"] +provides-extras = ["a2ui", "amazon-bedrock", "anthropic", "django", "fastapi", "flask", "google-cloud", "google-genai", "mcp", "middleware", "model-garden", "otel", "ollama", "openai"] [[package]] name = "genkit-a2ui" @@ -1874,6 +1870,32 @@ dev = [ { name = "pytest-xdist", specifier = ">=3.6.1" }, ] +[[package]] +name = "genkit-model-garden" +version = "0.13.0" +source = { editable = "packages/genkit-model-garden" } +dependencies = [ + { name = "genkit" }, + { name = "google-auth", extra = ["requests"] }, +] + +[package.optional-dependencies] +anthropic = [ + { name = "genkit-anthropic" }, +] +openai = [ + { name = "genkit-openai" }, +] + +[package.metadata] +requires-dist = [ + { name = "genkit", editable = "packages/genkit" }, + { name = "genkit-anthropic", marker = "extra == 'anthropic'", editable = "packages/genkit-anthropic" }, + { name = "genkit-openai", marker = "extra == 'openai'", editable = "packages/genkit-openai" }, + { name = "google-auth", extras = ["requests"], specifier = ">=2.14.1" }, +] +provides-extras = ["anthropic", "openai"] + [[package]] name = "genkit-ollama" version = "0.13.0" @@ -1921,32 +1943,6 @@ requires-dist = [ { name = "opentelemetry-api", specifier = ">=1.38.0" }, ] -[[package]] -name = "genkit-vertexai" -version = "0.13.0" -source = { editable = "packages/genkit-vertexai" } -dependencies = [ - { name = "genkit" }, - { name = "google-auth", extra = ["requests"] }, -] - -[package.optional-dependencies] -anthropic = [ - { name = "genkit-anthropic" }, -] -openai = [ - { name = "genkit-openai" }, -] - -[package.metadata] -requires-dist = [ - { name = "genkit", editable = "packages/genkit" }, - { name = "genkit-anthropic", marker = "extra == 'anthropic'", editable = "packages/genkit-anthropic" }, - { name = "genkit-openai", marker = "extra == 'openai'", editable = "packages/genkit-openai" }, - { name = "google-auth", extras = ["requests"], specifier = ">=2.14.1" }, -] -provides-extras = ["anthropic", "openai"] - [[package]] name = "genkit-workspace" version = "0.1.0" @@ -1963,10 +1959,10 @@ dependencies = [ { name = "genkit-google-genai" }, { name = "genkit-mcp" }, { name = "genkit-middleware" }, + { name = "genkit-model-garden" }, { name = "genkit-ollama" }, { name = "genkit-openai" }, { name = "genkit-otel" }, - { name = "genkit-vertexai" }, ] [package.dev-dependencies] @@ -2036,10 +2032,10 @@ requires-dist = [ { name = "genkit-google-genai", editable = "packages/genkit-google-genai" }, { name = "genkit-mcp", editable = "packages/genkit-mcp" }, { name = "genkit-middleware", editable = "packages/genkit-middleware" }, + { name = "genkit-model-garden", editable = "packages/genkit-model-garden" }, { name = "genkit-ollama", editable = "packages/genkit-ollama" }, { name = "genkit-openai", editable = "packages/genkit-openai" }, { name = "genkit-otel", editable = "packages/genkit-otel" }, - { name = "genkit-vertexai", editable = "packages/genkit-vertexai" }, ] [package.metadata.requires-dev] From 9ba902138261d1161ceae9f9f1946a62ee3a87db Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 17 Nov 2026 13:55:38 -0600 Subject: [PATCH 2/3] feat(py): keep genkit-vertexai as a deprecated alias for genkit-model-garden --- .github/workflows/publish_python.yml | 1 + packages/genkit-vertexai/LICENSE | 201 ++++++++++++++++++ packages/genkit-vertexai/README.md | 25 +++ packages/genkit-vertexai/pyproject.toml | 79 +++++++ .../src/genkit_vertexai/__init__.py | 53 +++++ .../src/genkit_vertexai/py.typed | 0 packages/genkit-vertexai/tests/shim_test.py | 46 ++++ pyproject.toml | 5 + scripts/check_consistency.py | 4 +- tests/version_bounds_guard_test.py | 9 +- uv.lock | 29 +++ 11 files changed, 449 insertions(+), 3 deletions(-) create mode 100644 packages/genkit-vertexai/LICENSE create mode 100644 packages/genkit-vertexai/README.md create mode 100644 packages/genkit-vertexai/pyproject.toml create mode 100644 packages/genkit-vertexai/src/genkit_vertexai/__init__.py create mode 100644 packages/genkit-vertexai/src/genkit_vertexai/py.typed create mode 100644 packages/genkit-vertexai/tests/shim_test.py diff --git a/.github/workflows/publish_python.yml b/.github/workflows/publish_python.yml index cfdb9dca6..99e400166 100644 --- a/.github/workflows/publish_python.yml +++ b/.github/workflows/publish_python.yml @@ -73,6 +73,7 @@ jobs: packages/genkit-ollama packages/genkit-openai packages/genkit-otel + packages/genkit-vertexai ) FAILED=() diff --git a/packages/genkit-vertexai/LICENSE b/packages/genkit-vertexai/LICENSE new file mode 100644 index 000000000..220539673 --- /dev/null +++ b/packages/genkit-vertexai/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 Google LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/genkit-vertexai/README.md b/packages/genkit-vertexai/README.md new file mode 100644 index 000000000..9703ad12f --- /dev/null +++ b/packages/genkit-vertexai/README.md @@ -0,0 +1,25 @@ +# genkit-vertexai (deprecated) + +`genkit-vertexai` is now [`genkit-model-garden`](https://github.com/genkit-ai/genkit-python/tree/main/packages/genkit-model-garden). +This package only re-exports `ModelGarden` from `genkit_model_garden` and warns +on import. It gets no releases for Genkit 1.0. + +## Migrate + +```bash +uv remove genkit-vertexai +uv add 'genkit-model-garden[anthropic]' # same [anthropic] and [openai] extras +``` + +```python +# before +from genkit_vertexai import ModelGarden +# after +from genkit_model_garden import ModelGarden +``` + +The `ModelGarden` class, its arguments and the `modelgarden/` model names are +unchanged, so saved model refs keep working. + +Gemini on Google Cloud was never in this package. It's `VertexAI` in +[`genkit-google-genai`](https://github.com/genkit-ai/genkit-python/tree/main/packages/genkit-google-genai). diff --git a/packages/genkit-vertexai/pyproject.toml b/packages/genkit-vertexai/pyproject.toml new file mode 100644 index 000000000..206fc9bc5 --- /dev/null +++ b/packages/genkit-vertexai/pyproject.toml @@ -0,0 +1,79 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +[project] +authors = [ + { name = "Google" }, + { name = "Yesudeep Mangalapilly", email = "yesudeep@google.com" }, + { name = "Elisa Shen", email = "mengqin@google.com" }, + { name = "Niraj Nepal", email = "nnepal@google.com" }, +] +classifiers = [ + "Development Status :: 7 - Inactive", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: AsyncIO", + "Framework :: Pydantic", + "Framework :: Pydantic :: 2", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Typing :: Typed", + "License :: OSI Approved :: Apache Software License", +] +dependencies = [ + "genkit>=0.13.0,<1", + "genkit-model-garden>=0.13.0,<1", +] +description = "Deprecated: renamed to genkit-model-garden" +keywords = [ + "genkit", + "model-garden", + "vertex-ai", +] +license = "Apache-2.0" +name = "genkit-vertexai" +readme = "README.md" +requires-python = ">=3.10" +version = "0.13.0" + +[project.optional-dependencies] +anthropic = ["genkit-model-garden[anthropic]>=0.13.0,<1"] +openai = ["genkit-model-garden[openai]>=0.13.0,<1"] + +[project.urls] +"Bug Tracker" = "https://github.com/genkit-ai/genkit-python/issues" +Changelog = "https://github.com/genkit-ai/genkit-python/releases" +"Documentation" = "https://genkit.dev/docs/get-started/?lang=python" +"Homepage" = "https://github.com/genkit-ai/genkit-python" +"Repository" = "https://github.com/genkit-ai/genkit-python" + +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + +[tool.hatch.build.targets.wheel] +only-include = ["src/genkit_vertexai"] +sources = ["src"] diff --git a/packages/genkit-vertexai/src/genkit_vertexai/__init__.py b/packages/genkit-vertexai/src/genkit_vertexai/__init__.py new file mode 100644 index 000000000..33453127b --- /dev/null +++ b/packages/genkit-vertexai/src/genkit_vertexai/__init__.py @@ -0,0 +1,53 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Deprecated: ``genkit-vertexai`` is now ``genkit-model-garden``. + +This package re-exports ``ModelGarden`` from ``genkit_model_garden`` and warns +on import. It gets no releases for Genkit 1.0. + +Example: + ```python + # 1. Replace the dependency, keeping the same extras + # uv remove genkit-vertexai + # uv add 'genkit-model-garden[anthropic]' + + # 2. Change the import; the plugin and model names are unchanged + from genkit import Genkit + from genkit_model_garden import ModelGarden + + ai = Genkit(plugins=[ModelGarden(project='bistro-prod', location='us-east5')]) + ``` +""" + +import warnings + +from genkit_model_garden import ModelGarden + +# FutureWarning rather than DeprecationWarning: Python hides DeprecationWarning +# unless it's attributed to __main__, and an import-time warning is attributed +# to the import machinery, so app developers would never see it. +warnings.warn( + 'genkit-vertexai is now genkit-model-garden. Replace the dependency with genkit-model-garden ' + '(same [anthropic] and [openai] extras) and import ModelGarden from genkit_model_garden. ' + 'genkit-vertexai gets no releases for Genkit 1.0.', + FutureWarning, + stacklevel=2, +) + +__all__ = [ + 'ModelGarden', +] diff --git a/packages/genkit-vertexai/src/genkit_vertexai/py.typed b/packages/genkit-vertexai/src/genkit_vertexai/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/packages/genkit-vertexai/tests/shim_test.py b/packages/genkit-vertexai/tests/shim_test.py new file mode 100644 index 000000000..49d4d8b16 --- /dev/null +++ b/packages/genkit-vertexai/tests/shim_test.py @@ -0,0 +1,46 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +"""The genkit-vertexai shim re-exports ModelGarden and tells users to switch.""" + +import importlib +import sys +from types import ModuleType + +import genkit_model_garden +import pytest + + +def _fresh_import() -> ModuleType: + sys.modules.pop('genkit_vertexai', None) + return importlib.import_module('genkit_vertexai') + + +def test_import_warns_with_replacement_package_and_module() -> None: + with pytest.warns(FutureWarning) as record: + _fresh_import() + + message = str(record[0].message) + assert 'genkit-model-garden' in message + assert 'genkit_model_garden' in message + + +def test_model_garden_is_the_same_class_as_genkit_model_garden() -> None: + with pytest.warns(FutureWarning): + shim = _fresh_import() + + assert shim.ModelGarden is genkit_model_garden.ModelGarden + assert shim.__all__ == ['ModelGarden'] diff --git a/pyproject.toml b/pyproject.toml index fa04f1a43..685bafe1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dependencies = [ "genkit-a2ui", "genkit-ollama", "genkit-model-garden", + "genkit-vertexai", ] description = "Workspace for Genkit packages" license = "Apache-2.0" @@ -182,6 +183,7 @@ genkit-otel = { workspace = true } genkit-a2ui = { workspace = true } genkit-ollama = { workspace = true } genkit-model-garden = { workspace = true } +genkit-vertexai = { workspace = true } [tool.uv.workspace] exclude = ["*/shared"] @@ -417,6 +419,7 @@ root = [ "packages/genkit-a2ui/src", "packages/genkit-ollama/src", "packages/genkit-model-garden/src", + "packages/genkit-vertexai/src", ".", # For samples.shared and other root-level imports ] @@ -455,6 +458,7 @@ extraPaths = [ "packages/genkit-a2ui/src", "packages/genkit-ollama/src", "packages/genkit-model-garden/src", + "packages/genkit-vertexai/src", ] pythonVersion = "3.10" reportMissingImports = true @@ -505,6 +509,7 @@ search-path = [ "packages/genkit-a2ui/src", "packages/genkit-ollama/src", "packages/genkit-model-garden/src", + "packages/genkit-vertexai/src", ".", ] python_version = "3.10" diff --git a/scripts/check_consistency.py b/scripts/check_consistency.py index 363d5f25c..0851fa18c 100755 --- a/scripts/check_consistency.py +++ b/scripts/check_consistency.py @@ -35,7 +35,9 @@ PY_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) EXPECTED_PYTHON = '>=3.10' -ZERO_X_ONLY_PACKAGES: frozenset[str] = frozenset({'genkit-evaluators'}) +# 0.x-only packages cap genkit at <1, and check_consistency fails a 1.0 bump while they exist. +# genkit-vertexai is the deprecated alias for genkit-model-garden. +ZERO_X_ONLY_PACKAGES: frozenset[str] = frozenset({'genkit-evaluators', 'genkit-vertexai'}) _INTRA_REPO_NAME_RE = re.compile(r'^\s*(genkit(?:-[a-z0-9-]+)?)\b') _EXACT_PIN_RE = re.compile(r'^(genkit(?:-[a-z0-9-]+)?)(?:\[[a-z0-9,_-]+\])?==([^,;\s]+)$') diff --git a/tests/version_bounds_guard_test.py b/tests/version_bounds_guard_test.py index fd132f304..32042daa8 100644 --- a/tests/version_bounds_guard_test.py +++ b/tests/version_bounds_guard_test.py @@ -165,12 +165,17 @@ def test_real_workspace_passes_consistency_and_extras_contract() -> None: if 'evaluators' in opt_deps: assert opt_deps['evaluators'] == [f'genkit-evaluators>={core_version},<1'] - # Every publishable plugin is reachable from at least one genkit[...] extra. + # Every publishable plugin is reachable from at least one genkit[...] extra. Renamed-package + # aliases are exempt: they only exist so the old pip name keeps installing the new package. + renamed_package_aliases = {'genkit-vertexai'} referenced_plugins = {spec.split('[', 1)[0].split('>=', 1)[0] for specs in opt_deps.values() for spec in specs} all_plugins = { p.name for p in (PY_DIR / 'packages').iterdir() - if p.is_dir() and p.name != 'genkit' and (p / 'pyproject.toml').exists() + if p.is_dir() + and p.name != 'genkit' + and p.name not in renamed_package_aliases + and (p / 'pyproject.toml').exists() } assert referenced_plugins == all_plugins diff --git a/uv.lock b/uv.lock index 880df03a1..47e0bb414 100644 --- a/uv.lock +++ b/uv.lock @@ -36,6 +36,7 @@ members = [ "genkit-ollama", "genkit-openai", "genkit-otel", + "genkit-vertexai", "genkit-workspace", "google-genai-deep-research", "google-genai-media", @@ -1943,6 +1944,32 @@ requires-dist = [ { name = "opentelemetry-api", specifier = ">=1.38.0" }, ] +[[package]] +name = "genkit-vertexai" +version = "0.13.0" +source = { editable = "packages/genkit-vertexai" } +dependencies = [ + { name = "genkit" }, + { name = "genkit-model-garden" }, +] + +[package.optional-dependencies] +anthropic = [ + { name = "genkit-model-garden", extra = ["anthropic"] }, +] +openai = [ + { name = "genkit-model-garden", extra = ["openai"] }, +] + +[package.metadata] +requires-dist = [ + { name = "genkit", editable = "packages/genkit" }, + { name = "genkit-model-garden", editable = "packages/genkit-model-garden" }, + { name = "genkit-model-garden", extras = ["anthropic"], marker = "extra == 'anthropic'", editable = "packages/genkit-model-garden" }, + { name = "genkit-model-garden", extras = ["openai"], marker = "extra == 'openai'", editable = "packages/genkit-model-garden" }, +] +provides-extras = ["anthropic", "openai"] + [[package]] name = "genkit-workspace" version = "0.1.0" @@ -1963,6 +1990,7 @@ dependencies = [ { name = "genkit-ollama" }, { name = "genkit-openai" }, { name = "genkit-otel" }, + { name = "genkit-vertexai" }, ] [package.dev-dependencies] @@ -2036,6 +2064,7 @@ requires-dist = [ { name = "genkit-ollama", editable = "packages/genkit-ollama" }, { name = "genkit-openai", editable = "packages/genkit-openai" }, { name = "genkit-otel", editable = "packages/genkit-otel" }, + { name = "genkit-vertexai", editable = "packages/genkit-vertexai" }, ] [package.metadata.requires-dev] From 0bc2c298d4bf40cc45dfa8f947c1817321e49d4d Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 17 Nov 2026 14:00:01 -0600 Subject: [PATCH 3/3] docs(py): describe Model Garden as Claude, Llama and other OpenAI-compatible models --- packages/genkit-model-garden/README.md | 2 +- packages/genkit-model-garden/pyproject.toml | 2 +- .../src/genkit_model_garden/__init__.py | 7 ++++--- .../src/genkit_model_garden/_plugin.py | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/genkit-model-garden/README.md b/packages/genkit-model-garden/README.md index abe5ba6dd..de03b28f0 100644 --- a/packages/genkit-model-garden/README.md +++ b/packages/genkit-model-garden/README.md @@ -1,6 +1,6 @@ # Genkit Model Garden Plugin -Call Claude, Llama, Mistral and other third-party models hosted in Google Cloud +Call Claude, Llama and other third-party models hosted in Google Cloud [Model Garden](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/model-garden/explore-models). Requests run on your Google Cloud project's credentials and billing, so you don't need a separate Anthropic or Meta account. diff --git a/packages/genkit-model-garden/pyproject.toml b/packages/genkit-model-garden/pyproject.toml index 99241bd50..21b1d7869 100644 --- a/packages/genkit-model-garden/pyproject.toml +++ b/packages/genkit-model-garden/pyproject.toml @@ -47,7 +47,7 @@ dependencies = [ "genkit>=0.13.0,<2", "google-auth[requests]>=2.14.1", ] -description = "Claude, Llama, and Mistral on Genkit through Google Cloud Model Garden" +description = "Claude, Llama, and other Google Cloud Model Garden models on Genkit" keywords = [ "genkit", "model-garden", diff --git a/packages/genkit-model-garden/src/genkit_model_garden/__init__.py b/packages/genkit-model-garden/src/genkit_model_garden/__init__.py index d5f5a96f9..259c0cd2a 100644 --- a/packages/genkit-model-garden/src/genkit_model_garden/__init__.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/__init__.py @@ -16,9 +16,10 @@ """Model Garden plugin for Genkit. -Calls third-party models hosted in Google Cloud Model Garden (Claude, Llama, -Mistral) on your Google Cloud project's credentials and billing. Gemini is not -in this package; it's ``VertexAI`` in ``genkit-google-genai``. +Calls third-party models hosted in Google Cloud Model Garden (Claude, Llama and +other OpenAI-compatible models) on your Google Cloud project's credentials and +billing. Gemini is not in this package; it's ``VertexAI`` in +``genkit-google-genai``. Example: ```python diff --git a/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py b/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py index d587a2799..de3856453 100644 --- a/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py +++ b/packages/genkit-model-garden/src/genkit_model_garden/_plugin.py @@ -205,11 +205,11 @@ async def _generate(request: ModelRequest, ctx: ModelContext) -> ModelResponse: class ModelGarden(Plugin): """Model Garden plugin for Genkit. - Serves third-party models (Claude, Llama, Mistral) hosted in Google Cloud - Model Garden, billed to your Google Cloud project. It handles - initialization of the Model Garden client and registration of model - actions. Gemini is not served here; use ``VertexAI`` from - ``genkit-google-genai``. + Serves third-party models (Claude, Llama and other OpenAI-compatible + models) hosted in Google Cloud Model Garden, billed to your Google Cloud + project. It handles initialization of the Model Garden client and + registration of model actions. Gemini is not served here; use + ``VertexAI`` from ``genkit-google-genai``. """ name = MODELGARDEN_PLUGIN_NAME