RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix too many clause while searching. (#5119)
Kevin Hue6c024f8bf97
diff --git a/rag/nlp/synonym.py b/rag/nlp/synonym.pyindex ba9f0a04a8..a826a32664 100644--- a/rag/nlp/synonym.py+++ b/rag/nlp/synonym.py@@ -66,7 +66,7 @@ class Dealer:except Exception as e:logging.error("Fail to load synonym!" + str(e))- def lookup(self, tk):+ def lookup(self, tk, topn=8):if re.match(r"[a-z]+$", tk):res = list(set([re.sub("_", " ", syn.name().split(".")[0]) for syn in wordnet.synsets(tk)]) - set([tk]))return [t for t in res if t]@@ -76,7 +76,7 @@ class Dealer:res = self.dictionary.get(re.sub(r"[ \t]+", " ", tk.lower()), [])if isinstance(res, str):res = [res]- return res+ return res[:topn]if __name__ == '__main__':diff --git a/rag/raptor.py b/rag/raptor.pyindex 6a60136050..eea7ae2790 100644--- a/rag/raptor.py+++ b/rag/raptor.py@@ -39,6 +39,7 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:if response:return responseresponse = self._llm_model.chat(system, history, gen_conf)+ response = re.sub(r"<think>.*</think>", "", response, flags=re.DOTALL)if response.find("**ERROR**") >= 0:raise Exception(response)set_llm_cache(self._llm_model.llm_name, system, response, history, gen_conf)