Skip to content

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

Fix: potential negative max_tokens in RAPTOR (#10701)

Yongteng Leicd77425b8726
diff --git a/rag/raptor.py b/rag/raptor.py
index 6ce776a680..191ecdeb4a 100644
--- a/rag/raptor.py
+++ b/rag/raptor.py
@@ -114,7 +114,7 @@ class RecursiveAbstractiveProcessing4TreeOrganizedRetrieval:
),
}
],
- {"max_tokens": self._max_token},
+ {"max_tokens": max(self._max_token, 512)}, # fix issue: #10235
)
cnt = re.sub(
"(······\n由于长度的原因,回答被截断了,要继续吗?|For the content length reason, it stopped, continue?)",