Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

fix: Graph_RAG.search returns 3-tuple in default mode too

dex0shubham791149a939a4
diff --git a/hyperextract/methods/rag/graph_rag.py b/hyperextract/methods/rag/graph_rag.py
index 8b9bd74..c9ad5fe 100644
--- a/hyperextract/methods/rag/graph_rag.py
+++ b/hyperextract/methods/rag/graph_rag.py
@@ -560,7 +560,9 @@ class Graph_RAG(AutoGraph[NodeSchema, EdgeSchema]):
"""
if use_community:
return self._global_search_impl(query, top_k_nodes, top_k_edges)
- return super().search(query, top_k_nodes, top_k_edges, top_k)
+ # Keep the 3-tuple contract: no community context in the default path.
+ nodes, edges = super().search(query, top_k_nodes, top_k_edges, top_k)
+ return nodes, edges, None
def _global_search_impl(
self,
diff --git a/hyperextract/types/graph.py b/hyperextract/types/graph.py
index 1878076..8995e43 100644
--- a/hyperextract/types/graph.py
+++ b/hyperextract/types/graph.py
@@ -1023,11 +1023,15 @@ class AutoGraph(
)
def search_callback(query: str) -> None:
- return self.search(
+ # search() may return (nodes, edges) or, in subclasses like
+ # Graph_RAG, (nodes, edges, context); ontosight only wants the
+ # first two.
+ result = self.search(
query,
top_k_nodes=top_k_nodes_for_search,
top_k_edges=top_k_edges_for_search,
)
+ return result[0], result[1]
def chat_callback(question: str) -> None:
response = self.chat(