Kevin Hu
commited on
Commit
·
d78b07c
1
Parent(s):
121b0b5
raise exception if embedding model not found (#3199)
Browse files### What problem does this PR solve?
#3173
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
api/db/services/dialog_service.py
CHANGED
|
@@ -162,6 +162,9 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|
| 162 |
attachments.extend(m["doc_ids"])
|
| 163 |
|
| 164 |
embd_mdl = LLMBundle(dialog.tenant_id, LLMType.EMBEDDING, embd_nms[0])
|
|
|
|
|
|
|
|
|
|
| 165 |
if llm_id2llm_type(dialog.llm_id) == "image2text":
|
| 166 |
chat_mdl = LLMBundle(dialog.tenant_id, LLMType.IMAGE2TEXT, dialog.llm_id)
|
| 167 |
else:
|
|
|
|
| 162 |
attachments.extend(m["doc_ids"])
|
| 163 |
|
| 164 |
embd_mdl = LLMBundle(dialog.tenant_id, LLMType.EMBEDDING, embd_nms[0])
|
| 165 |
+
if not embd_mdl:
|
| 166 |
+
raise LookupError("Embedding model(%s) not found" % embd_nms[0])
|
| 167 |
+
|
| 168 |
if llm_id2llm_type(dialog.llm_id) == "image2text":
|
| 169 |
chat_mdl = LLMBundle(dialog.tenant_id, LLMType.IMAGE2TEXT, dialog.llm_id)
|
| 170 |
else:
|