Skip to content

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

fixed: The choices may be empty. (#876)

dashi617421453ffff0d0
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index a652972a2c..9a2eec5d54 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -56,6 +56,7 @@ class Base(ABC):
stream=True,
**gen_conf)
for resp in response:
+ if len(resp.choices) == 0:continue
if not resp.choices[0].delta.content:continue
ans += resp.choices[0].delta.content
total_tokens += 1