community: fix neo4j from_existing_graph (#24912)

Fixes Neo4JVector.from_existing_graph integration with huggingface

Previously threw an error with existing databases, because
from_existing_graph query returns empty list of new nodes, which are
then passed to embedding function, and huggingface errors with empty
list.

Fixes [24401](https://github.com/langchain-ai/langchain/issues/24401)

---------

Co-authored-by: Jeff Katzy <jeffreyerickatz@gmail.com>
This commit is contained in:
jigsawlabs-student 2024-08-05 17:01:46 -04:00 committed by GitHub
parent d166967003
commit 427a04151c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1449,6 +1449,8 @@ class Neo4jVector(VectorStore):
"LIMIT 1000"
)
data = store.query(fetch_query, params={"props": text_node_properties})
if not data:
break
text_embeddings = embedding.embed_documents([el["text"] for el in data])
params = {