community: Fix database connections for neo4j (#27190)

Fixes https://github.com/langchain-ai/langchain/issues/27185

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Tomaz Bratanic 2024-10-09 05:17:55 +05:30 committed by GitHub
parent cedf4d9462
commit 481bd25d29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -430,7 +430,7 @@ class Neo4jGraph(GraphStore):
try:
data, _, _ = self._driver.execute_query(
Query(text=query, timeout=self.timeout),
database=self._database,
database_=self._database,
parameters_=params,
)
json_data = [r.data() for r in data]
@ -457,7 +457,7 @@ class Neo4jGraph(GraphStore):
):
raise
# fallback to allow implicit transactions
with self._driver.session() as session:
with self._driver.session(database=self._database) as session:
data = session.run(Query(text=query, timeout=self.timeout), params)
json_data = [r.data() for r in data]
if self.sanitize:

View File

@ -623,7 +623,7 @@ class Neo4jVector(VectorStore):
params = params or {}
try:
data, _, _ = self._driver.execute_query(
query, database=self._database, parameters_=params
query, database_=self._database, parameters_=params
)
return [r.data() for r in data]
except Neo4jError as e:
@ -646,7 +646,7 @@ class Neo4jVector(VectorStore):
):
raise
# Fallback to allow implicit transactions
with self._driver.session() as session:
with self._driver.session(database=self._database) as session:
data = session.run(Query(text=query), params)
return [r.data() for r in data]