@@ -203,6 +203,12 @@ def graph_schema_consolidation(graph):
203203 node_labels .extend (nodes_and_relations [0 ]['labels' ])
204204 relation_labels .extend (nodes_and_relations [0 ]['relationshipTypes' ])
205205
206+ exclude_node_labels = ['Document' ,'Chunk' ,'_Bloom_Perspective_' , '__Community__' , '__Entity__' ]
207+ exclude_relationship_labels = ['PART_OF' , 'NEXT_CHUNK' , 'HAS_ENTITY' , '_Bloom_Perspective_' ,'FIRST_CHUNK' ,'SIMILAR' ,'IN_COMMUNITY' ,'PARENT_COMMUNITY' ]
208+
209+ node_labels = [i for i in node_labels if i not in exclude_node_labels ]
210+ relation_labels = [i for i in relation_labels if i not in exclude_relationship_labels ]
211+
206212 parser = JsonOutputParser ()
207213 prompt = ChatPromptTemplate (messages = [("system" ,GRAPH_CLEANUP_PROMPT ),("human" , "{input}" )],
208214 partial_variables = {"format_instructions" : parser .get_format_instructions ()})
@@ -225,8 +231,10 @@ def graph_schema_consolidation(graph):
225231 if new_label != old_label :
226232 relation_match [old_label ]= new_label
227233
228- logging .info (f"updated node labels : { node_match } " )
234+ logging .info (f"updated node labels : { node_match } " )
235+ logging .info (f"Reduced node counts from { len (node_labels )} to { len (node_match .items ())} " )
229236 logging .info (f"updated relationship labels : { relation_match } " )
237+ logging .info (f"Reduced relationship counts from { len (relation_labels )} to { len (relation_match .items ())} " )
230238
231239 # Update node labels in graph
232240 for old_label , new_label in node_match .items ():
0 commit comments