diff --git a/libs/community/langchain_community/graphs/neo4j_graph.py b/libs/community/langchain_community/graphs/neo4j_graph.py index 4897348a7b977..55c03005d9aa3 100644 --- a/libs/community/langchain_community/graphs/neo4j_graph.py +++ b/libs/community/langchain_community/graphs/neo4j_graph.py @@ -555,10 +555,11 @@ def add_graph_documents( el["labelsOrTypes"] == [BASE_ENTITY_LABEL] and el["properties"] == ["id"] for el in self.structured_schema.get("metadata", {}).get( - "constraint" + "constraint", [] ) ] ) + if not constraint_exists: # Create constraint self.query(