Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
4469696
1
Parent(s):
64764e8
feat: 优化知识库问答功能
Browse files- modules/models/base_model.py +3 -2
- requirements.txt +2 -2
modules/models/base_model.py
CHANGED
@@ -373,8 +373,9 @@ class BaseLLMModel:
|
|
373 |
msg = "索引获取成功,生成回答中……"
|
374 |
logging.info(msg)
|
375 |
with retrieve_proxy():
|
376 |
-
retriever = VectorStoreRetriever(vectorstore=index, search_type="
|
377 |
-
|
|
|
378 |
try:
|
379 |
relevant_documents = retriever.get_relevant_documents(
|
380 |
fake_inputs)
|
|
|
373 |
msg = "索引获取成功,生成回答中……"
|
374 |
logging.info(msg)
|
375 |
with retrieve_proxy():
|
376 |
+
retriever = VectorStoreRetriever(vectorstore=index, search_type="similarity", search_kwargs={"k": 6})
|
377 |
+
# retriever = VectorStoreRetriever(vectorstore=index, search_type="similarity_score_threshold", search_kwargs={
|
378 |
+
# "k": 6, "score_threshold": 0.2})
|
379 |
try:
|
380 |
relevant_documents = retriever.get_relevant_documents(
|
381 |
fake_inputs)
|
requirements.txt
CHANGED
@@ -7,7 +7,7 @@ tqdm
|
|
7 |
colorama
|
8 |
googlesearch-python
|
9 |
Pygments
|
10 |
-
langchain==0.0.
|
11 |
markdown
|
12 |
PyPDF2
|
13 |
pdfplumber
|
@@ -21,7 +21,7 @@ duckduckgo-search>=3.9.5
|
|
21 |
arxiv
|
22 |
wikipedia
|
23 |
google.generativeai
|
24 |
-
openai
|
25 |
unstructured
|
26 |
google-api-python-client
|
27 |
tabulate
|
|
|
7 |
colorama
|
8 |
googlesearch-python
|
9 |
Pygments
|
10 |
+
langchain==0.0.316
|
11 |
markdown
|
12 |
PyPDF2
|
13 |
pdfplumber
|
|
|
21 |
arxiv
|
22 |
wikipedia
|
23 |
google.generativeai
|
24 |
+
openai==0.28.1
|
25 |
unstructured
|
26 |
google-api-python-client
|
27 |
tabulate
|