Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
Expand Down
25 changes: 21 additions & 4 deletions docs/api/vectorizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Vectorizers
compatibility:

- ``VoyageAITextVectorizer`` → Use ``VoyageAIVectorizer`` instead
- ``VertexAITextVectorizer`` → Use ``VertexAIVectorizer`` instead
- ``VertexAITextVectorizer`` → Use ``GoogleGenAIVectorizer`` instead
(``VertexAIVectorizer`` is itself deprecated; see below)
- ``BedrockTextVectorizer`` → Use ``BedrockVectorizer`` instead
- ``CustomTextVectorizer`` → Use ``CustomVectorizer`` instead

Expand Down Expand Up @@ -59,15 +60,31 @@ VertexAIVectorizer
.. currentmodule:: redisvl.utils.vectorize.vertexai

.. note::
For backwards compatibility, an alias ``VertexAITextVectorizer`` is available
in the ``redisvl.utils.vectorize.text`` module. This alias is deprecated
as of version 0.13.0 and will be removed in a future major release.
``VertexAIVectorizer`` is **deprecated**. It uses Google's Vertex AI
model-garden SDK, which Google has deprecated with a scheduled removal. Use
:class:`~redisvl.utils.vectorize.googlegenai.GoogleGenAIVectorizer` for text
embeddings on the supported ``google-genai`` SDK. The alias
``VertexAITextVectorizer`` (in ``redisvl.utils.vectorize.text``) is likewise
deprecated. Multimodal (image/video) migration is tracked in
`issue #620 <https://github.com/redis/redis-vl-python/issues/620>`_.

.. autoclass:: VertexAIVectorizer
:show-inheritance:
:members:


GoogleGenAIVectorizer
=====================

.. _googlegenaivectorizer_api:

.. currentmodule:: redisvl.utils.vectorize.googlegenai

.. autoclass:: GoogleGenAIVectorizer
:show-inheritance:
:members:


CohereTextVectorizer
====================

Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Vectorizers handle batching internally, breaking large batches into provider-app

### Supported Providers

RedisVL includes vectorizers for OpenAI, Azure OpenAI, Cohere, HuggingFace (local), Mistral, Google Vertex AI, AWS Bedrock, VoyageAI, and others. See the {doc}`/api/vectorizer` for the complete list. You can also create custom vectorizers that wrap any embedding function.
RedisVL includes vectorizers for OpenAI, Azure OpenAI, Cohere, HuggingFace (local), Mistral, Google (via `google-genai`, covering both Vertex AI and the Gemini Developer API), AWS Bedrock, VoyageAI, and others. See the {doc}`/api/vectorizer` for the complete list. You can also create custom vectorizers that wrap any embedding function.

## Rerankers

Expand Down
62 changes: 61 additions & 1 deletion docs/user_guide/04_vectorizers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Create Embeddings with Vectorizers\n",
"\n",
"This guide demonstrates how to create embeddings using RedisVL's built-in text vectorizers. RedisVL supports multiple embedding providers: OpenAI, HuggingFace, Ollama, Vertex AI, Cohere, Mistral AI, Amazon Bedrock, VoyageAI, and custom vectorizers.\n",
"This guide demonstrates how to create embeddings using RedisVL's built-in text vectorizers. RedisVL supports multiple embedding providers: OpenAI, HuggingFace, Ollama, Google (Vertex AI and the Gemini Developer API), Cohere, Mistral AI, Amazon Bedrock, VoyageAI, and custom vectorizers.\n",
"\n",
"## Prerequisites\n",
"\n",
Expand Down Expand Up @@ -360,6 +360,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"> **⚠️ Deprecated.** `VertexAIVectorizer` uses Google's Vertex AI model-garden SDK, which Google has deprecated with a scheduled removal. For text embeddings use the **Google Gen AI** vectorizer shown in the next section (`GoogleGenAIVectorizer`) on the supported `google-genai` SDK. Multimodal (image/video) migration is tracked in [issue #620](https://github.com/redis/redis-vl-python/issues/620).\n",
"\n",
"### VertexAI\n",
"\n",
"[VertexAI](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings) is GCP's fully-featured AI platform including a number of pretrained LLMs. RedisVL supports using VertexAI to create embeddings from these models. To use VertexAI, you will first need to install the ``google-cloud-aiplatform`` library.\n",
Expand Down Expand Up @@ -402,6 +404,64 @@
"test[:10]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Google Gen AI\n",
"\n",
"The `GoogleGenAIVectorizer` uses Google's [`google-genai`](https://pypi.org/project/google-genai/) SDK — the supported replacement for the deprecated Vertex AI model-garden SDK. It reaches **both** Google embedding backends from a single client:\n",
"\n",
"- **Vertex AI / Gemini Enterprise** — GCP project auth (`project_id` + `location`, credentials via ADC).\n",
"- **Gemini Developer API** — a single `api_key`.\n",
"\n",
"Install it with `pip install redisvl[google-genai]`.\n",
"\n",
"**Migrating from `VertexAIVectorizer`:**\n",
"\n",
"| | `VertexAIVectorizer` (deprecated) | `GoogleGenAIVectorizer` |\n",
"|---|---|---|\n",
"| SDK | `google-cloud-aiplatform` (deprecated) | `google-genai` (supported) |\n",
"| Default model | `textembedding-gecko` (768 dims) | `gemini-embedding-001` (3072 dims) |\n",
"| Backends | Vertex AI only | Vertex AI **and** Gemini Developer API |\n",
"| Async | no | yes (`aembed`, `aembed_many`) |\n",
"\n",
"Because the default model and dimensions differ, embeddings are **not** interchangeable — reindex when you switch. When you request a reduced `output_dimensionality`, the vectorizer L2-normalizes the result so it stays valid for Redis COSINE / inner-product search.\n",
"\n",
"**Set one of the following:**\n",
"\n",
"```\n",
"# Gemini Developer API\n",
"GEMINI_API_KEY=<your gemini api key>\n",
"\n",
"# or Vertex AI\n",
"GOOGLE_CLOUD_PROJECT=<your gcp project id>\n",
"GOOGLE_CLOUD_LOCATION=<your gcp region>\n",
"GOOGLE_APPLICATION_CREDENTIALS=<path to your gcp JSON creds>\n",
"```\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# NBVAL_SKIP (docs example; not executed in CI so notebook validation makes no API calls)\n",
"from redisvl.utils.vectorize import GoogleGenAIVectorizer\n",
"\n",
"# Auto-detects the backend: GEMINI_API_KEY -> Gemini, else GCP project/location -> Vertex AI.\n",
"# Guarded so this notebook still runs when Google credentials aren't configured.\n",
"try:\n",
" genai_vectorizer = GoogleGenAIVectorizer(model=\"gemini-embedding-001\")\n",
" print(f\"backend={genai_vectorizer.backend}, dims={genai_vectorizer.dims}\")\n",
" genai_test = genai_vectorizer.embed(\"This is a test sentence.\")\n",
" print(genai_test[:10])\n",
"except (ImportError, ValueError) as e:\n",
" print(f\"Skipping GoogleGenAIVectorizer demo: {e}\")\n",
" genai_vectorizer = None\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
3 changes: 2 additions & 1 deletion docs/user_guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ $ pip install redisvl[cohere] # Cohere embeddings and reranking
$ pip install redisvl[mistralai] # Mistral AI embeddings
$ pip install redisvl[voyageai] # Voyage AI embeddings and reranking
$ pip install redisvl[sentence-transformers] # HuggingFace local embeddings
$ pip install redisvl[vertexai] # Google Vertex AI embeddings
$ pip install redisvl[google-genai] # Google embeddings (Vertex AI + Gemini API)
$ pip install redisvl[vertexai] # Google Vertex AI embeddings (legacy; deprecated, multimodal only)
$ pip install redisvl[bedrock] # AWS Bedrock embeddings

# Other optional features
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,19 @@ cohere = ["cohere>=4.44"]
voyageai = ["voyageai>=0.2.2"]
sentence-transformers = ["sentence-transformers>=3.4.0,<4"]
langcache = ["langcache>=0.11.0"]
# Legacy Google backend for the deprecated VertexAIVectorizer. The <2.0.0 cap is
# intentional: Google's model-garden modules (vertexai.language_models /
# vertexai.vision_models) that this vectorizer imports are deprecated with a
# scheduled removal. They still ship in the 1.x line (latest 1.162.0); the 2.0.0
# release that drops them is yanked on PyPI. Keep the cap so the deprecated class
# (and its multimodal path, which has no google-genai replacement yet) keeps
# importing. New text embeddings should use the `google-genai` extra below.
vertexai = [
"google-cloud-aiplatform>=1.26,<2.0.0",
"protobuf>=5.28.0,<6.0.0",
]
# Modern Google backend (Vertex AI + Gemini Developer API) for GoogleGenAIVectorizer.
google-genai = ["google-genai>=1.0.0"]
bedrock = [
"boto3>=1.36.0,<2",
"urllib3<2.2.0",
Expand All @@ -67,6 +76,7 @@ all = [
"langcache>=0.11.0",
"google-cloud-aiplatform>=1.26,<2.0.0",
"protobuf>=5.28.0,<6.0.0",
"google-genai>=1.0.0",
"boto3>=1.36.0,<2",
"urllib3<2.2.0",
"pillow>=11.3.0",
Expand Down
10 changes: 9 additions & 1 deletion redisvl/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,15 @@ def decorator(cls):

@wraps(original_init)
def new_init(self, *args, **kwargs):
warn(warning_message, category=DeprecationWarning, stacklevel=2)
# Emit only once per instance. When a deprecated subclass wraps a
# deprecated parent, both __init__ wrappers run via super().__init__;
# the sentinel keeps that to a single warning.
if not getattr(self, "_deprecation_warned", False):
warn(warning_message, category=DeprecationWarning, stacklevel=2)
try:
object.__setattr__(self, "_deprecation_warned", True)
except Exception:
pass
original_init(self, *args, **kwargs)

cls.__init__ = new_init
Expand Down
4 changes: 4 additions & 0 deletions redisvl/utils/vectorize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from redisvl.utils.vectorize.base import BaseVectorizer, Vectorizers
from redisvl.utils.vectorize.bedrock import BedrockVectorizer
from redisvl.utils.vectorize.custom import CustomVectorizer
from redisvl.utils.vectorize.googlegenai import GoogleGenAIVectorizer
from redisvl.utils.vectorize.text.azureopenai import AzureOpenAITextVectorizer
from redisvl.utils.vectorize.text.bedrock import BedrockTextVectorizer
from redisvl.utils.vectorize.text.cohere import CohereTextVectorizer
Expand All @@ -20,6 +21,7 @@
"CohereTextVectorizer",
"HFTextVectorizer",
"OpenAITextVectorizer",
"GoogleGenAIVectorizer",
"VertexAIVectorizer",
"VertexAITextVectorizer",
"AzureOpenAITextVectorizer",
Expand Down Expand Up @@ -61,6 +63,8 @@ def vectorizer_from_dict(
return OllamaTextVectorizer(**args)
elif vectorizer_type == Vectorizers.vertexai:
return VertexAIVectorizer(**args)
elif vectorizer_type == Vectorizers.google_genai:
return GoogleGenAIVectorizer(**args)
elif vectorizer_type == Vectorizers.voyageai:
return VoyageAIVectorizer(**args)
else:
Expand Down
1 change: 1 addition & 0 deletions redisvl/utils/vectorize/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Vectorizers(Enum):
mistral = "mistral"
ollama = "ollama"
vertexai = "vertexai"
google_genai = "google_genai"
hf = "hf"
voyageai = "voyageai"

Expand Down
Loading
Loading