mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-23 02:27:55 +00:00
feat:rag_graph
This commit is contained in:
parent
aff0553b7e
commit
39219a4fdc
@ -129,6 +129,11 @@ class RAGGraphEngine:
|
|||||||
)
|
)
|
||||||
|
|
||||||
result = [future.result() for future in future_tasks]
|
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
|
return index_struct
|
||||||
# for doc in documents:
|
# for doc in documents:
|
||||||
# triplets = self._extract_triplets(doc.page_content)
|
# triplets = self._extract_triplets(doc.page_content)
|
||||||
@ -162,8 +167,9 @@ class RAGGraphEngine:
|
|||||||
print(
|
print(
|
||||||
f"current thread-{thread_id} end extract triplets tasks, triplets-{triplets}"
|
f"current thread-{thread_id} end extract triplets tasks, triplets-{triplets}"
|
||||||
)
|
)
|
||||||
for triplet in triplets:
|
return triplets
|
||||||
subj, _, obj = triplet
|
# for triplet in triplets:
|
||||||
self.graph_store.upsert_triplet(*triplet)
|
# subj, _, obj = triplet
|
||||||
self.graph_store.upsert_triplet(*triplet)
|
# self.graph_store.upsert_triplet(*triplet)
|
||||||
index_struct.add_node([subj, obj], text_node)
|
# self.graph_store.upsert_triplet(*triplet)
|
||||||
|
# index_struct.add_node([subj, obj], text_node)
|
||||||
|
@ -145,7 +145,7 @@ class RAGGraphSearch(BaseSearch):
|
|||||||
if len(sorted_nodes_with_scores) == 0:
|
if len(sorted_nodes_with_scores) == 0:
|
||||||
logger.info("> No nodes found by keywords, returning empty response.")
|
logger.info("> No nodes found by keywords, returning empty response.")
|
||||||
return [
|
return [
|
||||||
NodeWithScore(node=TextNode(text="No relationships found."), score=1.0)
|
Document(page_content="No relationships found.")
|
||||||
]
|
]
|
||||||
|
|
||||||
# add relationships as Node
|
# add relationships as Node
|
||||||
|
Loading…
Reference in New Issue
Block a user