chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.96k stars 5.56k forks source link

感觉知识库问答的逻辑很奇怪,不支持追问 #3980

Closed e68862230 closed 4 months ago

e68862230 commented 6 months ago

问题描述 / Problem Description 我问关键词“实验室”有哪些人,它可以回答,但是我追问说xxx是做什么的,它就无法查询到答案。。

预期的结果 / Expected Result 正常不是应该它带着人名和上下文中的实验室这个关键词一起去查找么

环境信息 / Environment Information

dosubot[bot] commented 6 months ago

It looks like the issue you're encountering with multi-turn conversations in the Langchain-Chatchat system might be due to how context is managed between questions. The system uses a conversation history to maintain context, which involves tracking the conversation, searching and re-ranking documents, constructing prompts, generating responses, and updating the history. This process is crucial for ensuring that the context from previous questions is considered in subsequent responses.

To address your specific problem, you might need to adjust several configurations related to the milvus vector library, the number of vectors considered for matching, the score threshold, and the text splitter configuration. These adjustments can help improve the system's ability to handle context in multi-turn conversations. You can find guidance on these configurations in the kb_config.py.example file in the Langchain-Chatchat repository.

Additionally, there are two issues in the repository that could be relevant: one discussing the implementation of context association in multi-turn Q&A and another addressing repeated answers in multi-turn dialogues. These might offer some insights or solutions to your problem.

Unfortunately, I couldn't find specific changes in the knowledge base Q&A logic between your version and the latest, or detailed interactions between the Qwen-14B model, the bge-large-zh v1.5 embedding model, and the 'milvus' vector library in multi-turn conversations. For further assistance, more detailed information about your setup and the steps you're taking would be helpful.

#### Details **Sources** - [请问有实现多轮问答中基于问题的搜索上下文关联么](https://github.com/chatchat-space/Langchain-Chatchat/issues/468) - [[BUG] 多轮对话中,后续问题会继续重复回答第一个问题 / Concise description of the issue](https://github.com/chatchat-space/Langchain-Chatchat/issues/2152) - [server/chat/knowledge_base_chat.py](https://github.com/chatchat-space/Langchain-Chatchat/blob/master/server/chat/knowledge_base_chat.py) - [configs/kb_config.py.example](https://github.com/chatchat-space/Langchain-Chatchat/blob/master/configs/kb_config.py.example)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

lr13953301387 commented 6 months ago

你有试过从api里调用么? 我看他api里 knowledgebasechat里是有history这一项的

e68862230 commented 6 months ago

你有试过从api里调用么? 我看他api里 knowledgebasechat里是有history这一项的

都是webui上面试的,历史会话也打开了

xiaohundun commented 6 months ago

knowledge_base_chat.py这个文件的实现,这块没做好,正常情况下应该要根据历史会话去向大模型获取新的向量查询 query 的,但是现在看代码只是拿当前用户的 query 去查的,跟上下文没关系,可以自己改一下

mazisuki commented 5 months ago

有人实现了吗,用了下确实效果很差