Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Remove thinking block from keyword node's result (#6474)

Graf224205997e82156c
diff --git a/agent/component/keyword.py b/agent/component/keyword.py
index 3b71441c0d..1e7cbacde8 100644
--- a/agent/component/keyword.py
+++ b/agent/component/keyword.py
@@ -57,9 +57,10 @@ class KeywordExtract(Generate, ABC):
ans = chat_mdl.chat(self._param.get_prompt(), [{"role": "user", "content": query}],
self._param.gen_conf())
+ ans = re.sub(r"<think>.*</think>", "", ans, flags=re.DOTALL)
ans = re.sub(r".*keyword:", "", ans).strip()
logging.debug(f"ans: {ans}")
return KeywordExtract.be_output(ans)
def debug(self, **kwargs):
- return self._run([], **kwargs)
\ No newline at end of file
+ return self._run([], **kwargs)