Python: [BREAKING] Add Gemini Embedding 2 and vector task options - #8798
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Integration-test gates currently skip the default embedding model and the new Enterprise chat mode.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds Gemini Embedding 2 support and provider-specific vector embedding options while standardizing Gemini configuration on GOOGLE_*.
Changes:
- Adds text/multimodal Gemini embedding clients and shared authentication.
- Forwards per-operation embedding options through vector APIs and tools.
- Adds tests, documentation, and retrieval samples.
| File | Description |
|---|---|
python/uv.lock |
Updates Gemini package and Google SDK versions. |
python/samples/README.md |
Documents Google configuration variables. |
python/samples/02-agents/vector_stores/README.md |
Explains vector embedding options. |
python/samples/02-agents/providers/gemini/README.md |
Documents new Gemini samples and settings. |
python/samples/02-agents/providers/gemini/gemini_with_google_search.py |
Updates configuration guidance. |
python/samples/02-agents/providers/gemini/gemini_with_google_maps.py |
Updates configuration guidance. |
python/samples/02-agents/providers/gemini/gemini_with_code_execution.py |
Updates configuration guidance. |
python/samples/02-agents/providers/gemini/gemini_search_agent.py |
Adds text retrieval sample. |
python/samples/02-agents/providers/gemini/gemini_image_search_agent.py |
Adds cross-modal image search sample. |
python/samples/02-agents/providers/gemini/gemini_embeddings.py |
Adds embedding task sample. |
python/samples/02-agents/providers/gemini/gemini_basic.py |
Updates configuration guidance. |
python/samples/02-agents/providers/gemini/gemini_advanced.py |
Updates configuration guidance. |
python/packages/gemini/tests/test_gemini_client.py |
Tests shared chat authentication changes. |
python/packages/gemini/tests/gemini/test_gemini_embedding_client.py |
Tests embedding behavior and integration. |
python/packages/gemini/README.md |
Documents embeddings and migration. |
python/packages/gemini/pyproject.toml |
Bumps package and SDK versions. |
python/packages/gemini/AGENTS.md |
Records Gemini package conventions. |
python/packages/gemini/agent_framework_gemini/_sdk_client.py |
Centralizes SDK authentication and endpoints. |
python/packages/gemini/agent_framework_gemini/_embedding_client.py |
Implements Gemini embedding clients. |
python/packages/gemini/agent_framework_gemini/_chat_client.py |
Adopts shared authentication and Google settings. |
python/packages/gemini/agent_framework_gemini/__init__.py |
Exports embedding APIs. |
python/packages/core/tests/core/test_vectors.py |
Tests embedding-option forwarding. |
python/packages/core/tests/core/test_gemini_namespace.py |
Tests lazy Gemini exports. |
python/packages/core/AGENTS.md |
Documents vector option contracts. |
python/packages/core/agent_framework/gemini/__init__.pyi |
Adds embedding type exports. |
python/packages/core/agent_framework/gemini/__init__.py |
Adds lazy embedding exports. |
python/packages/core/agent_framework/_vectors.py |
Adds embedding options across vector operations. |
python/.env.example |
Migrates Gemini environment names. |
docs/specs/feature-usage-bit-registry.md |
Extends Gemini feature usage description. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (2 commit(s)): b88e1b88d5f3, 1d5960d21f71
Model: gpt-5.6-sol-fast
Overview
The review found 1 verified inline finding(s).
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/core/agent_framework/gemini/__init__.py
1d5960d to
57ed687
Compare
Jose Alvarez (jpalvarezl)
left a comment
There was a problem hiding this comment.
Looks good. The new embedding and search options are wired through consistently, and the settings migration is documented. No substantive concerns from my review.

Motivation & Context
The Google portion of #4171 needs an embedding client for the current Gemini Embedding 2 service. Asymmetric retrieval requires different document and query instructions; generic vector operations previously supplied only dimensions, leaving no way to select those tasks without application-specific adapters.
Description & Review Guide
GeminiEmbeddingClient/RawGeminiEmbeddingClientusinggoogle-genai2.25+, defaulting to stablegemini-embedding-2. Map Google-supported text tasks per call, preserve unprefixed media and mixed-media content, and handle Developer API batching versus Enterprise's single-content requests. Forward mutually exclusive flat or by-field embedding options through vector upserts, and query options through search and generated tools; field dimensions remain authoritative. Add provider exports, SDK-backed tests, and text/image search Agent samples usingcreate_vector_search_tool.GOOGLE_*settings namespace and support the currentGOOGLE_GENAI_USE_ENTERPRISEmode. Breaking beta change: chat no longer readsGEMINI_API_KEYorGEMINI_MODELor exportsGeminiSettings; useGOOGLE_API_KEYandGOOGLE_MODEL. The new embedding client readsGOOGLE_EMBEDDING_MODEL. Vector operations without embedding options retain their previous behavior; conflicting dimensions fail before embedding.Related Issue
Part of #4171: this PR implements only Google AI / Vertex AI embeddings. NVIDIA is still outstanding, so merging this PR must not close the parent issue. No other open PR was found for the Google embedding task.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and title prefix in sync automatically.