Skip to content

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

make gemini robust (#3012)

Kevin Hu9457d20ef1e4
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index d6589e0ab8..8e9dd8924c 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -780,10 +780,11 @@ class GeminiChat(Base):
ans += resp.text
yield ans
+ yield response._chunks[-1].usage_metadata.total_token_count
except Exception as e:
yield ans + "\n**ERROR**: " + str(e)
- yield response._chunks[-1].usage_metadata.total_token_count
+ yield 0
class GroqChat: