Skip to content

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

Fix: Adjust ExecutionStrategy of THINKING_MODES. (#17862)

Kevin Hud2183e610d10
diff --git a/rag/advanced_rag/harness/config.py b/rag/advanced_rag/harness/config.py
index b618495248..c7af23a0b4 100644
--- a/rag/advanced_rag/harness/config.py
+++ b/rag/advanced_rag/harness/config.py
@@ -15,7 +15,7 @@ THINKING_MODES: dict[str, ExecutionStrategy] = {
max_orchestrator_cycles=1,
max_agent_cycles=0,
max_parallel_agents=1,
- available_tools=["hybrid_search"],
+ available_tools=["hybrid_search", "web_search", "bm25_search"],
sufficiency_threshold=0.85,
partial_threshold=0.50,
fallback_to_direct_llm=False,
@@ -32,7 +32,7 @@ THINKING_MODES: dict[str, ExecutionStrategy] = {
max_orchestrator_cycles=3,
max_agent_cycles=0,
max_parallel_agents=1,
- available_tools=["hybrid_search"],
+ available_tools=["hybrid_search", "web_search", "bm25_search"],
sufficiency_threshold=0.75,
partial_threshold=0.40,
fallback_to_direct_llm=False,
@@ -41,7 +41,7 @@ THINKING_MODES: dict[str, ExecutionStrategy] = {
label="high",
execution_strategy="agentic_research",
requires_decomposition=True,
- requires_agent_loop=True,
+ requires_agent_loop=False,
requires_sufficiency_judge=True,
requires_selective_gen=True,
allows_dynamic_claims=False,
@@ -52,6 +52,7 @@ THINKING_MODES: dict[str, ExecutionStrategy] = {
available_tools=[
"hybrid_search",
"web_search",
+ "bm25_search",
"ontology_navigate",
"dataset_navigation_by_tree",
"graph_explore",
diff --git a/rag/advanced_rag/knowlege_compile/wiki_incremental.py b/rag/advanced_rag/knowlege_compile/wiki_incremental.py
index 1ee89ef68e..b9f5f727a9 100644
--- a/rag/advanced_rag/knowlege_compile/wiki_incremental.py
+++ b/rag/advanced_rag/knowlege_compile/wiki_incremental.py
@@ -1669,12 +1669,14 @@ async def _wiki_refine_page(
# Embed for search
from common.misc_utils import thread_pool_exec
+ from rag.nlp import rag_tokenizer
embeddings, _ = await thread_pool_exec(embd_mdl.encode, [summary or content[:200]])
# Derive vector dimension from the embedding shape
emb_arr = np.asarray(embeddings[0])
vec_dim = int(emb_arr.shape[0]) if emb_arr.ndim >= 1 and emb_arr.shape[0] else 768
+ content_ltks = rag_tokenizer.tokenize(content)
page = {
"id": _stable_row_id(WIKI_PAGE_COMPILE_KWD, kb_id, page_id),
@@ -1691,6 +1693,9 @@ async def _wiki_refine_page(
"page_type_kwd": page_type_kwd,
"compile_kwd": WIKI_PAGE_COMPILE_KWD,
"knowledge_graph_kwd": WIKI_PAGE_COMPILE_KWD,
+ "title_tks": rag_tokenizer.tokenize(page_title),
+ "content_ltks": content_ltks,
+ "content_sm_ltks": rag_tokenizer.fine_grained_tokenize(content_ltks),
}
# Insert vector (adds q_{dim}_vec field)
vec_col = f"q_{vec_dim}_vec"
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index d34d679d1a..5393b449d0 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -1999,7 +1999,7 @@ class LiteLLMBase(ABC):
content = json.dumps(result, ensure_ascii=False)
else:
content = str(result)
- hist.append({"role": "tool", "tool_call_id": tc.id, "content": content.replace("</think>", "")})
+ hist.append({"role": "tool", "tool_call_id": tc.id, "content": content.replace("</think>", "") + ("</think>" if content.find("<think>") >= 0 else "")})
return hist
def bind_tools(self, toolcall_session=None, tools=None):