Skip to content

[BUG] 使用milvus向量库查询时逻辑有误 #5061

Open
@cheriL

Description

@cheriL

问题描述 / Problem Description

使用milvus向量库查询时逻辑有误,导致结果不准确:

  1. 当前是通过similarity_search_with_score()方法获取docs,但实际上这个方法返回的不是相似度,如果是L2返回的实际是distance,应调用similarity_search_with_relevance_scores方法;
  2. 当前chatchat使用的是langchain_community中的milvus库,这个库实际上已经废弃且未实现上述方法中的具体逻辑,这边参考了langchain_milvus实现;

复现问题的步骤 / Steps to Reproduce

search_doc()即可测试

预期的结果 / Expected Result

返回准确的doc.

实际结果 / Actual Result

环境信息 / Environment Information

  • Langchain-Chatchat 版本 / commit 号:master 分支
  • 部署方式(pypi 安装 / 源码部署 / docker 部署):源码部署
  • 使用的模型推理框架(Xinference / Ollama / OpenAI API 等):
  • 使用的 LLM 模型(GLM-4-9B / Qwen2-7B-Instruct 等):
  • 使用的 Embedding 模型(bge-large-zh-v1.5 / m3e-base 等):bge-large-zh-v1.5
  • 使用的向量库类型 (faiss / milvus / pg_vector 等): milvus
  • 操作系统及版本 / Operating system and version: linux ubuntu22.04
  • Python 版本 / Python version: 3.10
  • 推理使用的硬件(GPU / CPU / MPS / NPU 等) / Inference hardware (GPU / CPU / MPS / NPU, etc.): GPU
  • 其他相关环境信息 / Other relevant environment information:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions