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] Agent模式下无法设置system提示词 #5204

Open
mttbyte opened this issue Jan 24, 2025 · 3 comments
Open

[BUG] Agent模式下无法设置system提示词 #5204

mttbyte opened this issue Jan 24, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@mttbyte
Copy link

mttbyte commented Jan 24, 2025

问题描述
当chat加入tools后,设置的system提示词失效

复现问题的步骤

  1. 在不加入tools(非Agent)的情况下,写入system提示词
  2. 进行对话,会发现llm明确自己的身份
  3. 在加入tools(Agent)的情况下,写入system提示词
  4. 进行对话,会发现llm为原始的大模型的身份,无法获取到system提示词的信息。

预期的结果
llm返回内容应当包含system相关的信息。

实际结果 / Actual Result
llm返回的信息为模型本身的信息。

环境信息 / Environment Information

  • Langchain-Chatchat 版本 / commit 号:0.3.1.3
  • 部署方式:pip
  • 使用的模型推理框架:Xinference
  • 使用的 LLM 模型:qwen2.5-instruct
  • 使用的 Embedding 模型:bge-base-zh-v1.5
  • 使用的向量库类型: faiss
  • 操作系统及版本: Ubuntu22.04
  • Python 版本: 3.10 (xinference为3.9)
  • 推理使用的硬件: GPU Nvidia RTX 4090
@mttbyte mttbyte added the bug Something isn't working label Jan 24, 2025
Copy link

dosubot bot commented Jan 24, 2025

The issue you're experiencing with the system prompt not working in Agent mode when tools are added is related to the qwen model's inability to perform tool calls with streaming. In Langchain-Chatchat version 0.3.1.3, this problem arises because the qwen model cannot handle streaming during tool calls, which affects the system prompt's functionality in Agent mode [1].

To address this, the code includes a patch that modifies the plan and aplan methods to work without streaming. This change ensures that the qwen model can perform tool calls without relying on streaming, allowing the system prompt to function correctly in Agent mode [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@mttbyte
Copy link
Author

mttbyte commented Jan 24, 2025

The issue you're experiencing with the system prompt not working in Agent mode when tools are added is related to the qwen model's inability to perform tool calls with streaming. In Langchain-Chatchat version 0.3.1.3, this problem arises because the qwen model cannot handle streaming during tool calls, which affects the system prompt's functionality in Agent mode [1].

To address this, the code includes a patch that modifies the plan and aplan methods to work without streaming. This change ensures that the qwen model can perform tool calls without relying on streaming, allowing the system prompt to function correctly in Agent mode [1].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

thank you for your reply, robot. But in all of the post, I set "stream" to "false", i am sure that it doesn't cause by "stream" key.

Copy link

dosubot bot commented Jan 24, 2025

If the issue persists even with streaming set to "false," it might be related to other configurations or conditions in the Langchain-Chatchat codebase that could override or disable the system prompt in Agent mode. Unfortunately, I couldn't find specific details in the repository about configurations that might cause the system prompt to be ignored or overridden. It might be helpful to review the integration of the system prompt in the ChatPromptTemplate and ensure that the tools are correctly formatted and included in the prompt [1][2][3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

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

1 participant