Skip to content

Commit

Permalink
feat: 优化知识库问答功能
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Nov 16, 2023
1 parent 64764e8 commit 4469696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ def prepare_inputs(self, real_inputs, use_websearch, files, reply_language, chat
msg = "索引获取成功,生成回答中……"
logging.info(msg)
with retrieve_proxy():
retriever = VectorStoreRetriever(vectorstore=index, search_type="similarity_score_threshold", search_kwargs={
"k": 6, "score_threshold": 0.5})
retriever = VectorStoreRetriever(vectorstore=index, search_type="similarity", search_kwargs={"k": 6})
# retriever = VectorStoreRetriever(vectorstore=index, search_type="similarity_score_threshold", search_kwargs={
# "k": 6, "score_threshold": 0.2})
try:
relevant_documents = retriever.get_relevant_documents(
fake_inputs)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tqdm
colorama
googlesearch-python
Pygments
langchain==0.0.276
langchain==0.0.316
markdown
PyPDF2
pdfplumber
Expand All @@ -21,7 +21,7 @@ duckduckgo-search>=3.9.5
arxiv
wikipedia
google.generativeai
openai>=0.27.9
openai==0.28.1
unstructured
google-api-python-client
tabulate
Expand Down

0 comments on commit 4469696

Please sign in to comment.