Import VectorSearchIndex from its canonical module#435
Merged
Conversation
`databricks.vector_search.client` re-exported `VectorSearchIndex` only as a side effect of doing `from databricks.vector_search.index import VectorSearchIndex` at the top of `client.py`. A recent release of `databricks-vectorsearch` (and/or the new `databricks-ai-search` package) removes that line, breaking every consumer that did `from databricks.vector_search.client import VectorSearchIndex`. The canonical home of `VectorSearchIndex` has been `databricks.vector_ search.index` since at least 0.55. Import from there, with a try/except preferring the new `databricks.ai_search.index` location so the bridge keeps working regardless of which underlying package the user installs. Reproduces user's traceback from the app-templates LangGraph template: ImportError: cannot import name 'VectorSearchIndex' from 'databricks.vector_search.client'
4 tasks
- ruff format/check: add the blank line ruff format wants above the
try/except import block; let ruff --fix re-sort the import sections
so I001 is happy.
- integrations/langchain depends on databricks-openai (via
databricks_langchain.utils), but its pyproject left databricks-openai
to come from PyPI. With PyPI now shipping databricks-vectorsearch
>=0.74 (which removed the VectorSearchIndex re-export from
databricks.vector_search.client), the PyPI databricks-openai 0.15.0
blows up at import time and the langchain test job can't even
collect. Add `databricks-openai = { path = "../openai", editable
= true }` to [tool.uv.sources] so CI uses the (fixed) source.
The openai_cross_version_test matrix (v0.3.0/v0.4.0/v0.5.0) checks out
historical tags whose openai integration has the same broken import
that this PR fixes for HEAD. Those tests can't be fixed by this PR
because the historical sources are frozen — they need either a pin on
databricks-vectorsearch<0.74 in the matrix, or to be dropped. Tracking
separately.
The openai_test (v0.3.0/v0.4.0/v0.5.0) jobs check out historical tags of integrations/openai and run them against current PyPI. Those historical sources import `VectorSearchIndex` from `databricks.vector_search.client` (the bug this PR fixes for HEAD), and `databricks-vectorsearch>=0.74` removed that re-export. The frozen sources can't be fixed, so constrain the env to the version range they were validated against.
…matrix" This reverts commit 6fab1a4.
The earlier try/except favoring `databricks.ai_search.index` was speculative future-proofing for a possible package rename, but `databricks-ai-search==0.73` itself exposes `VectorSearchIndex` only as a back-compat alias for `AISearchIndex` (`databricks/ai_search/index.py:682`). Today and on every released `databricks-vectorsearch` from 0.50 onward, `databricks.vector_search. index.VectorSearchIndex` is the canonical class — so a one-line direct import suffices and the cascade was just indirection. Validated under simulated `databricks-vectorsearch>=0.74` breakage (legacy `databricks.vector_search.client.VectorSearchIndex` attribute removed): - reproduces the user's `ImportError` for the legacy path - fixed `databricks_openai.vector_search_retriever_tool` imports cleanly - all 53 openai unit tests pass under the simulated breakage
bbqiu
approved these changes
Jun 9, 2026
This was referenced Jun 9, 2026
jennsun
added a commit
that referenced
this pull request
Jun 9, 2026
…ot `.client`) The original docstrings said `databricks.vector_search.client. VectorSearchIndex.similarity_search` — the same wrong-path incidental-re-export bug that PR #435 fixed in the actual code. The earlier bulk sed in this PR carried the bug forward into the new package name, producing `databricks.ai_search.client.VectorSearchIndex` which does not even resolve (the new `databricks.ai_search.client` imports `AISearchIndex`, not `VectorSearchIndex`; only the alias on `.index` exists). Fix the docstrings to point at the real home of the class: databricks.ai_search.client.VectorSearchIndex → databricks.ai_search.index.VectorSearchIndex
jennsun
added a commit
that referenced
this pull request
Jun 9, 2026
## Summary `databricks-vectorsearch` is deprecated and has been renamed to `databricks-ai-search`. Follow-up to #435. When tests run, `databricks-vectorsearch` now emits: > DeprecationWarning: databricks-vectorsearch is deprecated and has been renamed to databricks-ai-search. Imports under 'databricks.vector_search.*' will continue to work as a thin re-export of 'databricks.ai_search.*', but new code should switch to 'pip install databricks-ai-search' and 'from databricks.ai_search.* import ...'. This PR follows that recommendation literally. ## Changes - **`pyproject.toml` × 4** (root, `integrations/openai`, `integrations/langchain`, `integrations/llamaindex`): replace `databricks-vectorsearch>=*` with `databricks-ai-search>=0.73`. - **12 Python files** under `src/`, `integrations/*/src/`, `integrations/*/tests/`, and `tests/`: every `from databricks.vector_search.* import ...` → `from databricks.ai_search.* import ...`. Includes `mock.patch` target strings and the `ImportError` fallback message in `databricks_langchain/vectorstores.py`. - Symbol names are unchanged. `databricks-ai-search==0.73` exposes back-compat aliases for the names the bridge uses: - `databricks/ai_search/client.py:1090`: `VectorSearchClient = AISearchClient` - `databricks/ai_search/index.py:682`: `VectorSearchIndex = AISearchIndex` - `databricks/ai_search/exceptions.py:47`: `VectorSearchException = AISearchException` - `Reranker`, `DatabricksReranker`, `CredentialStrategy` exist under the same submodule paths. Net diff: **+54 / −54 across 16 files** (pure rename). ## Validation - **Package landscape**: in a fresh venv with the migrated branch installed editable, only `databricks-ai-search==0.73` is present — `databricks-vectorsearch` is no longer pulled at all. - **Smoke**: `from databricks_openai.vector_search_retriever_tool import VectorSearchRetrieverTool` resolves `VectorSearchIndex` to `databricks.ai_search.index` even with the `databricks.vector_search` package completely absent. - **Tests**: - 53/53 openai unit tests pass. - 258/258 langchain unit tests pass (4 pre-existing skips). - `ruff check` + `ruff format --check` clean. ## Companion notes - This complements #435 (the `VectorSearchIndex` canonical-path fix). With both changes shipped, the bridge no longer touches the `databricks.vector_search.*` namespace at all and stops triggering the deprecation warning. - The langchain pyproject's `databricks-openai = { path = "../openai", editable = true }` source pin (added in #435) is preserved — still needed until the next `databricks-openai` release containing the canonical-path fix ships to PyPI; can be removed in a follow-up cleanup after that release. - Out of scope: the cross-version matrix (`openai_test (3.10, v0.x)` / `langchain_test (3.10, v0.x)`) still tests *historical* tags whose frozen source imports `databricks.vector_search.client.VectorSearchIndex`. Those tags cannot be retroactively migrated — this PR doesn't try to. Tracked separately for Dhruv. ## Test plan - [ ] CI green on this branch - [ ] After merge + release: any consumers of `databricks_ai_bridge`, `databricks_langchain`, `databricks_openai`, or `databricks_llamaindex` no longer see the upstream `DeprecationWarning` about `databricks-vectorsearch`
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
context: https://databricks.slack.com/archives/C065NC65Q9F/p1780691337648119
Fix
ImportError: cannot import name 'VectorSearchIndex' from 'databricks.vector_search.client'that breaks every consumer ofdatabricks_openai.vector_search_retriever_tool(transitively:databricks_langchain, app-templates LangGraph template, etc.) oncedatabricks-vectorsearch>=0.74removes theclient.pyre-export.Root cause
VectorSearchIndexhas lived canonically indatabricks.vector_search.indexsincedatabricks-vectorsearch==0.50(verified against 0.50/0.55/0.68/0.73 wheels). It was importable fromdatabricks.vector_search.clientonly as a side effect ofclient.pydoingfrom databricks.vector_search.index import VectorSearchIndexnear the top of its own module.The new
databricks-vectorsearch>=0.74release (which now also pullsdatabricks-ai-search>=0.73as a transitive dep) removed that side-effect import, so consumers that wrotefrom databricks.vector_search.client import VectorSearchIndexblow up — the bridge being one of them. (Aside:databricks-ai-search==0.73exposesVectorSearchIndexas a back-compat alias forAISearchIndexviadatabricks.ai_search.index, but the rename doesn't matter for this fix — the canonicaldatabricks.vector_search.indexpath keeps working on every released version ofdatabricks-vectorsearch.)Fix
Import
VectorSearchIndexfrom its canonical location:Applied in 5 files — 1 production module (
integrations/openai/src/databricks_openai/vector_search_retriever_tool.py) and 4 test/test-util files that had the same broken import. Net diff: +6/−5.Companion change in
integrations/langchain/pyproject.toml: adddatabricks-openai = { path = "../openai", editable = true }to[tool.uv.sources]so the langchain test job uses the in-flightdatabricks-openaisource (which has the fix) instead of the broken PyPI release, mirroring the existingdatabricks-ai-bridgesource pin. This is a dev/CI-only directive —[tool.uv.sources]is stripped from published wheels, so end users still resolvedatabricks-openaifrom PyPI per the unchangeddatabricks-openai>=0.14.0dep.Reproduction (mimics the failure path the user hit on the LangGraph template)
For local reproduction without access to a 0.74 build, simulate the breakage on an older vectorsearch by importing the module and deleting the attribute:
import databricks.vector_search.client as c; del c.VectorSearchIndex— same effect.Validation
integrations/openai/tests/unit_tests/test_vector_search_retriever_tool.pypass on the fixed source under simulated 0.74 breakage (del databricks.vector_search.client.VectorSearchIndexinjected via conftest).grep -rn "from databricks.vector_search.client import VectorSearchIndex"returns zero hits across the fixed codebase.databricks-vectorsearch==0.50/0.55/0.68/0.73wheels — all havedatabricks.vector_search.index.VectorSearchIndexdefined as a class.Release implications
Once merged, this needs a
databricks-ai-bridgepatch release so downstream consumers (app-templates LangGraph template,databricks-langchain,databricks-openai) pick up the fix from PyPI without a git pin.The companion app-templates change at databricks/app-templates#235 temporarily pins the langgraph templates at this branch's git URL so customers aren't blocked while the release goes out; that pin should be removed once the bridge release ships.
CI status
3 non-Required cross-version matrix jobs fail (
openai_test (3.10, v0.3.0 / v0.4.0 / v0.5.0)); all Required checks are green.These 3 failures pre-exist on main. Verified via a no-op baseline PR (#436): an empty commit off
upstream/maintriggers CI and reproduces 14 failures, all 3 of which are also failing here — plus 11 more that this PR fixes. So PR #435 is a strict improvement over current main state.The matrix runs frozen historical sources from old tags against current PyPI and is hit by two unrelated upstream API drifts:
databricks-vectorsearch>=0.74removed theVectorSearchIndexre-export fromdatabricks.vector_search.client. Historical sources still import from that path. (Same bug this PR fixes for HEAD; the historical sources are frozen by tag and can't pick up the fix.)mlflow2.x removedmlflow.get_last_active_trace()in favor ofget_last_active_trace_id(). Historical test code still calls the old name; the matrix's existingmlflow<3pin is too loose.Both predate this PR and are surfaced only because main hadn't re-run CI since 2026-05-13. Being handed off to the integration-tests owner to triage separately (options: tighter per-entry
mlflow:pin, install each historical tag'suv.lockfor exact dep parity, or retire the cross-version matrix).Test plan
uv syncinapp-templates/agent-langgraphwith the companion override and start the agent server — no ImportError on agent bootcc @vadim-antonov (Databricks Vector Search) — heard you've been working on a related change on the VS side; please flag if there's something here that should be coordinated.