-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Example Code
index_information = retrieve_vector_index_info(
driver=self._driver,
index_name=self.index_name,
label_or_type=self.node_label,
embedding_property=self.embedding_node_property,
neo4j_database=self._database # <-- Correct way
)
Error Message and Stack Trace (if applicable)
No response
Description
While using retrieve_existing_index()
, we call retrieve_vector_index_info()
, which expects a neo4j_database
argument. However, we are not passing any database name to this function. As a result, it defaults to using the neo4j
database for retrieving vector index information, regardless of which database is actually being used for the data (as specified in the config).
Code Reference:
index_information = retrieve_vector_index_info(
driver=self._driver,
index_name=self.index_name,
label_or_type=self.node_label,
embedding_property=self.embedding_node_property,
# neo4j_database is not passed here
)
According to the docstring for retrieve_vector_index_info()
:
neo4j_database (Optional[str]): The name of the Neo4j database.
If not provided, this defaults to the server's default database ("neo4j" by default)
(see reference to documentation: https://neo4j.com/docs/operations-manual/current/database-administration/#manage-databases-default)
Issue/Impact:
-
If the vector index is not present in the
neo4j
database, or if the nodes with the expected vector dimension exist in a different database, the function will either fail or returnNone
. -
This can lead to inconsistencies, especially in multi-database environments where the data and the vector index may not reside in the default
neo4j
database.
Expected Behavior:
retrieve_existing_index()
should explicitly pass the correct database name (from config or user input) to retrieve_vector_index_info()
to ensure consistency and correctness.
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
Python Version: 3.12.9 (main, Feb 4 2025, 14:38:38) [Clang 16.0.0 (clang-1600.0.26.6)]
Package Information
langchain_core: 0.3.63
langchain: 0.3.25
langchain_community: 0.3.24
langsmith: 0.2.10
langchain_neo4j: 0.4.0
langchain_openai: 0.2.14
langchain_text_splitters: 0.3.8
langgraph_sdk: 0.1.74
Optional packages not installed
langserve
Other Dependencies
aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
httpx>=0.25.2: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-azure-ai;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.51: Installed. No version info available.
langchain-core<1.0.0,>=0.3.58: Installed. No version info available.
langchain-core<1.0.0,>=0.3.59: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-perplexity;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<1.0.0,>=0.3.25: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.126: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
neo4j: 5.28.2
neo4j-graphrag: 1.9.0
numpy>=1.26.2;: Installed. No version info available.
numpy>=2.1.0;: Installed. No version info available.
openai: 1.98.0
orjson: 3.11.1
orjson>=3.10.1: Installed. No version info available.
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.11.7
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic>=2.7.4: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.4
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken: 0.9.0
typing-extensions>=4.7: Installed. No version info available.
zstandard: Installed. No version info available.