The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community: Apache AGE wrapper. Ensure Node Uniqueness by ID. (#28759)
German Martin3a1d05394d54
diff --git a/libs/community/langchain_community/graphs/age_graph.py b/libs/community/langchain_community/graphs/age_graph.pyindex 4fba85731a..434491253c 100644--- a/libs/community/langchain_community/graphs/age_graph.py+++ b/libs/community/langchain_community/graphs/age_graph.py@@ -697,8 +697,9 @@ class AGEGraph(GraphStore):# query for inserting nodesnode_insert_query = ("""- MERGE (n:`{label}` {properties})- """+ MERGE (n:`{label}` {{`id`: "{id}"}})+ SET n = {properties}+ """if not include_sourceelse """MERGE (n:`{label}` {properties})@@ -735,6 +736,7 @@ class AGEGraph(GraphStore):query = node_insert_query.format(label=AGEGraph.clean_graph_labels(node.type),properties=self._format_properties(node.properties),+ id=node.id,)self.query(query)diff --git a/libs/community/tests/integration_tests/graphs/test_age_graph.py b/libs/community/tests/integration_tests/graphs/test_age_graph.pyindex 383ddb62f8..32c2fab33c 100644--- a/libs/community/tests/integration_tests/graphs/test_age_graph.py+++ b/libs/community/tests/integration_tests/graphs/test_age_graph.py@@ -10,7 +10,11 @@ from langchain_community.graphs.graph_document import GraphDocument, Node, Relattest_data = [GraphDocument(- nodes=[Node(id="foo", type="foo"), Node(id="bar", type="bar")],+ nodes=[+ Node(id="foo", type="foo"),+ Node(id="bar", type="bar"),+ Node(id="foo", type="foo", properties={"property_a": "a"}),+ ],relationships=[Relationship(source=Node(id="foo", type="foo"),