feat:rag_graph

This commit is contained in:
aries_ckt 2023-10-19 12:02:27 +08:00
parent aff0553b7e
commit 39219a4fdc
2 changed files with 12 additions and 6 deletions

View File

@ -129,6 +129,11 @@ class RAGGraphEngine:
)
result = [future.result() for future in future_tasks]
# for triplet in triplets:
# subj, _, obj = triplet
# self.graph_store.upsert_triplet(*triplet)
# self.graph_store.upsert_triplet(*triplet)
# index_struct.add_node([subj, obj], text_node)
return index_struct
# for doc in documents:
# triplets = self._extract_triplets(doc.page_content)
@ -162,8 +167,9 @@ class RAGGraphEngine:
print(
f"current thread-{thread_id} end extract triplets tasks, triplets-{triplets}"
)
for triplet in triplets:
subj, _, obj = triplet
self.graph_store.upsert_triplet(*triplet)
self.graph_store.upsert_triplet(*triplet)
index_struct.add_node([subj, obj], text_node)
return triplets
# for triplet in triplets:
# subj, _, obj = triplet
# self.graph_store.upsert_triplet(*triplet)
# self.graph_store.upsert_triplet(*triplet)
# index_struct.add_node([subj, obj], text_node)

View File

@ -145,7 +145,7 @@ class RAGGraphSearch(BaseSearch):
if len(sorted_nodes_with_scores) == 0:
logger.info("> No nodes found by keywords, returning empty response.")
return [
NodeWithScore(node=TextNode(text="No relationships found."), score=1.0)
Document(page_content="No relationships found.")
]
# add relationships as Node