Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError: MilvusKBService.do_search() takes 4 positional arguments but 5 were given/ 使用milvus知识库提问报错 #1229

Closed
linguibin opened this issue Aug 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@linguibin
Copy link

问题描述 / Problem Description
界面添加文档到知识库正常但是使用milvus知识库提问报错/ Describe the problem in a clear and concise manner.

复现问题的步骤 / Steps to Reproduce

  1. 执行 python init_database.py 启动api以及webui
  2. 点击对话,选择知识库问答,输入问题
    3
    image
    . 问题出现 / Problem occurs
    api日志:
    File "/root/miniconda3/envs/langchain/lib/python3.10/site-packages/starlette/responses.py", line 262, in stream_response
    async for chunk in self.body_iterator:
    File "/home/Langchain-Chatchat/server/chat/knowledge_base_chat.py", line 57, in knowledge_base_chat_iterator
    docs = search_docs(query, knowledge_base_name, top_k, score_threshold)
    File "/home/Langchain-Chatchat/server/knowledge_base/kb_doc_api.py", line 26, in search_docs
    docs = kb.search_docs(query, top_k, score_threshold)
    File "/home/Langchain-Chatchat/server/knowledge_base/kb_service/base.py", line 119, in search_docs
    docs = self.do_search(query, top_k, score_threshold, embeddings)
    TypeError: MilvusKBService.do_search() takes 4 positional arguments but 5 were given
    预期的结果 / Expected Result
    正常作答

实际结果 / Actual Result
界面报错

环境信息 / Environment Information

  • langchain-ChatGLM v0.2.2-preview/50c6369f46f67ab763e2abcd4f8197f403ba1252
  • 是否使用 Docker 部署(是/否):否
  • 使用的模型(ChatGLM2-6B / Qwen-7B 等):ChatGLM2-6B
  • 使用的 Embedding 模型(moka-ai/m3e-base 等):m3e-base
  • 使用的向量库类型 (faiss / milvus / pg_vector 等):milvus,
  • 操作系统及版本 / Operating system and version: Alibaba Cloud Linux (Aliyun Linux) release 2.1903 LTS
  • Python 版本 / Python version: 3.10.12
  • 其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
添加与问题相关的任何其他信息 / Add any other information related to the issue.

@linguibin linguibin added the bug Something isn't working label Aug 24, 2023
@Pickupppp
Copy link

这个因为 base.py 中 调用 self.do_search(query, top_k, score_threshold, embeddings),但是 milvus 类中一次更新去掉了 socre_threshold 这个参数,你在 milvus_kb_service.pydo_search() 中加入对应的变量就可以了

@liunux4odoo
Copy link
Collaborator

这个因为 base.py 中 调用 self.do_search(query, top_k, score_threshold, embeddings),但是 milvus 类中一次更新去掉了 socre_threshold 这个参数,你在 milvus_kb_service.pydo_search() 中加入对应的变量就可以了

更新代码即可,新版已经修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants