KevinHuSh
commited on
Commit
·
22b2836
1
Parent(s):
1d694ff
add doc ids in API: completion (#827)
Browse files### What problem does this PR solve?
#808
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
api/db/services/dialog_service.py
CHANGED
|
@@ -118,7 +118,9 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|
| 118 |
else:
|
| 119 |
kbinfos = retrievaler.retrieval(" ".join(questions), embd_mdl, dialog.tenant_id, dialog.kb_ids, 1, dialog.top_n,
|
| 120 |
dialog.similarity_threshold,
|
| 121 |
-
dialog.vector_similarity_weight,
|
|
|
|
|
|
|
| 122 |
knowledges = [ck["content_with_weight"] for ck in kbinfos["chunks"]]
|
| 123 |
chat_logger.info(
|
| 124 |
"{}->{}".format(" ".join(questions), "\n->".join(knowledges)))
|
|
|
|
| 118 |
else:
|
| 119 |
kbinfos = retrievaler.retrieval(" ".join(questions), embd_mdl, dialog.tenant_id, dialog.kb_ids, 1, dialog.top_n,
|
| 120 |
dialog.similarity_threshold,
|
| 121 |
+
dialog.vector_similarity_weight,
|
| 122 |
+
doc_ids=kwargs.get("doc_ids", "").split(","),
|
| 123 |
+
top=1024, aggs=False)
|
| 124 |
knowledges = [ck["content_with_weight"] for ck in kbinfos["chunks"]]
|
| 125 |
chat_logger.info(
|
| 126 |
"{}->{}".format(" ".join(questions), "\n->".join(knowledges)))
|