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
Reformat error message. (#4829)
Kevin Hu78982d88e0c5
diff --git a/api/apps/llm_app.py b/api/apps/llm_app.pyindex 5acd764b37..ff78c65a0a 100644--- a/api/apps/llm_app.py+++ b/api/apps/llm_app.py@@ -209,21 +209,22 @@ def add_llm():}msg = ""+ mdl_nm = llm["llm_name"].split("___")[0]if llm["model_type"] == LLMType.EMBEDDING.value:mdl = EmbeddingModel[factory](key=llm['api_key'],- model_name=llm["llm_name"],+ model_name=mdl_nm,base_url=llm["api_base"])try:arr, tc = mdl.encode(["Test if the api key is available"])if len(arr[0]) == 0:raise Exception("Fail")except Exception as e:- msg += f"\nFail to access embedding model({llm['llm_name']})." + str(e)+ msg += f"\nFail to access embedding model({mdl_nm})." + str(e)elif llm["model_type"] == LLMType.CHAT.value:mdl = ChatModel[factory](key=llm['api_key'],- model_name=llm["llm_name"],+ model_name=mdl_nm,base_url=llm["api_base"])try:@@ -232,12 +233,12 @@ def add_llm():if not tc:raise Exception(m)except Exception as e:- msg += f"\nFail to access model({llm['llm_name']})." + str(+ msg += f"\nFail to access model({mdl_nm})." + str(e)elif llm["model_type"] == LLMType.RERANK:mdl = RerankModel[factory](key=llm["api_key"],- model_name=llm["llm_name"],+ model_name=mdl_nm,base_url=llm["api_base"])try:@@ -245,12 +246,12 @@ def add_llm():if len(arr) == 0:raise Exception("Not known.")except Exception as e:- msg += f"\nFail to access model({llm['llm_name']})." + str(+ msg += f"\nFail to access model({mdl_nm})." + str(e)elif llm["model_type"] == LLMType.IMAGE2TEXT.value:mdl = CvModel[factory](key=llm["api_key"],- model_name=llm["llm_name"],+ model_name=mdl_nm,base_url=llm["api_base"])try:@@ -259,16 +260,16 @@ def add_llm():if not tc:raise Exception(m)except Exception as e:- msg += f"\nFail to access model({llm['llm_name']})." + str(e)+ msg += f"\nFail to access model({mdl_nm})." + str(e)elif llm["model_type"] == LLMType.TTS:mdl = TTSModel[factory](- key=llm["api_key"], model_name=llm["llm_name"], base_url=llm["api_base"]+ key=llm["api_key"], model_name=mdl_nm, base_url=llm["api_base"])try:for resp in mdl.tts("Hello~ Ragflower!"):passexcept RuntimeError as e:- msg += f"\nFail to access model({llm['llm_name']})." + str(e)+ msg += f"\nFail to access model({mdl_nm})." + str(e)else:# TODO: check other type of modelspass