Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

dependencies/vertexai.py eagerly imports the deprecated vertexai.preview.rag, so every evaluation import warns

已關閉 適合新手
#7,415 2 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 4 天內回覆

@llalitkumarrr 已經在處理了。

開始於 2026年10月6日。

  • #7417 來自 @a2105z —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
74/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
backend

研究方向

閱讀 src/google/adk/dependencies/vertexai.py 並檢查其模組層級的匯入,接著檢查 evaluation/vertex_ai_eval_facade.py 和 tools/retrieval/vertex_ai_rag_retrieval.py,以了解哪些程式碼需要 RAG。執行重現命令,並將警告視為錯誤。完成的標準是:匯入評估 facade 不再引發例外或發出 RAG 棄用警告,同時 RAG 功能仍可使用。

由索引模型根據 Issue 內容生成。

描述

Required Information

Describe the Bug:
google/adk/dependencies/vertexai.py imports vertexai.preview.rag at module level. Since google-cloud-aiplatform deprecated that module, the import emits a UserWarning on load. Every ADK module that imports anything from ..dependencies.vertexai therefore triggers it, even when it only needs vertexai itself. That includes evaluation/vertex_ai_eval_facade.py:29 (from ..dependencies.vertexai import vertexai) and the other evaluation modules. As a result, every AgentEvaluator / adk eval run prints the deprecation warning, although no RAG code is used. Under -W error::UserWarning (or filterwarnings = error in pytest) the import fails.

The code is unchanged on main (d4e092e997): src/google/adk/dependencies/vertexai.py:19 still reads from vertexai.preview import rag as rag.

Steps to Reproduce:

  1. pip install "google-adk[eval]==2.11.0" "google-cloud-aiplatform==1.163.0".
  2. python -W error::UserWarning -c "import google.adk.evaluation.vertex_ai_eval_facade"

Expected Behavior:
Importing ADK's evaluation modules emits no deprecation warning for a module they do not use. The RAG import should happen only where RAG is used (tools/retrieval/vertex_ai_rag_retrieval.py already imports it only under TYPE_CHECKING, line 35, and inside the call, line 103), or move to the replacement client.

Observed Behavior:

  File ".../google/adk/evaluation/vertex_ai_eval_facade.py", line 29, in <module>
  File ".../google/adk/dependencies/vertexai.py", line 19, in <module>
  File ".../vertexai/preview/rag/__init__.py", line 186, in <module>
UserWarning: The `vertexai.preview.rag` module is deprecated and will be removed in a future version. Please migrate to the `agentplatform` client. For example:

    import agentplatform

    client = agentplatform.Client(project="your-project", location="us-central1")
    client.rag.create_corpus(...)

Without -W error, the same warning appears in pytest's warnings summary of every evaluation test.

Environment Details:

  • ADK Library Version: 2.11.0 (code identical on main d4e092e997)
  • Desktop OS: macOS 27.2
  • Python Version: 3.12.8

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (import-time behaviour)

Optional Information

Regression:
The ADK code is not new. The warning appears with google-cloud-aiplatform 1.163.0, which deprecates vertexai.preview.rag. Once that module is removed, the import in dependencies/vertexai.py would fail outright, taking the evaluation modules with it.

Possible fix:
Drop the eager from vertexai.preview import rag from dependencies/vertexai.py. Let the RAG retrieval tool import vertexai.preview.rag inside the call, where it already defers the import, or migrate it to the agentplatform client the deprecation message names. example_stores, imported the same way, emits no warning today.

主要語言
Python
星號
21.9k
分支
4.2k
平均合併
3 天 16 小時
30 天內合併 PR
6

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

google/adk-python 的其他 Issue

查看 google/adk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。