RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Refactor:Improve the chat stream logic for NvidiaCV (#9242)
Stephen Hu0a303d9ae182
diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.pyindex 328591b6dd..758d471bc1 100644--- a/rag/llm/cv_model.py+++ b/rag/llm/cv_model.py@@ -623,15 +623,18 @@ class NvidiaCV(Base):return "**ERROR**: " + str(e), 0def chat_streamly(self, system, history, gen_conf, images=[], **kwargs):+ total_tokens = 0try:response = self._request(self._form_history(system, history, images), gen_conf)cnt = response["choices"][0]["message"]["content"]+ if "usage" in response and "total_tokens" in response["usage"]:+ total_tokens += response["usage"]["total_tokens"]for resp in cnt:yield respexcept Exception as e:yield "\n**ERROR**: " + str(e)- yield response["usage"]["total_tokens"]+ yield total_tokensclass AnthropicCV(Base):