Skip to content

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

Fix: Add a basic example when the example of content_tagging is empty (#6276)

zhou9cad60fa6d63
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index f1e16c094e..f353c44a44 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -359,6 +359,8 @@ async def build_chunks(task, progress_callback):
cached = get_llm_cache(chat_mdl.llm_name, d["content_with_weight"], all_tags, {"topn": topn_tags})
if not cached:
picked_examples = random.choices(examples, k=2) if len(examples)>2 else examples
+ if not picked_examples:
+ picked_examples.append({"content": "This is an example", TAG_FLD: {'example': 1}})
async with chat_limiter:
cached = await trio.to_thread.run_sync(lambda: content_tagging(chat_mdl, d["content_with_weight"], all_tags, picked_examples, topn=topn_tags))
if cached: