mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-27 21:45:08 +00:00
langchain: Fix Neo4jVector vector store reference from partner package for self query (#28292)
_This should only be merged once neo4j is included under libs/partners._ # **Description:** Neo4jVector from langchain-community is being moved to langchain-neo4j: [see link](https://github.com/langchain-ai/langchain-neo4j/blob/main/libs/neo4j/langchain_neo4j/vectorstores/neo4j_vector.py#L436). To solve the issue below, this PR adds an attempt to import `Neo4jVector` from the partner package `langchain-neo4j`, similarly to the other partner packages. # **Issue:** When initializing `SelfQueryRetriever`, the following error is raised: ``` ValueError: Self query retriever with Vector Store type <class 'langchain_neo4j.vectorstores.neo4j_vector.Neo4jVector'> not supported. ``` [See related issue](https://github.com/langchain-ai/langchain/issues/19748). # **Dependencies:** - langchain-neo4j
This commit is contained in:
parent
a1c90794e1
commit
7d95a10ada
@ -161,6 +161,14 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
|
||||
if isinstance(vectorstore, MongoDBAtlasVectorSearch):
|
||||
return MongoDBAtlasTranslator()
|
||||
|
||||
try:
|
||||
from langchain_neo4j import Neo4jVector
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
if isinstance(vectorstore, Neo4jVector):
|
||||
return Neo4jTranslator()
|
||||
|
||||
try:
|
||||
from langchain_chroma import Chroma
|
||||
except ImportError:
|
||||
|
Loading…
Reference in New Issue
Block a user