Skip to content

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

raise exception if embedding model not found (#3199)

Kevin Hu18ae8a409192
diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py
index 4245a284f5..1e5fd8c793 100644
--- a/api/db/services/dialog_service.py
+++ b/api/db/services/dialog_service.py
@@ -162,6 +162,9 @@ def chat(dialog, messages, stream=True, **kwargs):
attachments.extend(m["doc_ids"])
embd_mdl = LLMBundle(dialog.tenant_id, LLMType.EMBEDDING, embd_nms[0])
+ if not embd_mdl:
+ raise LookupError("Embedding model(%s) not found" % embd_nms[0])
+
if llm_id2llm_type(dialog.llm_id) == "image2text":
chat_mdl = LLMBundle(dialog.tenant_id, LLMType.IMAGE2TEXT, dialog.llm_id)
else: