自我检查
- 这仅用于报告错误,如果您想提问,请访问 Discussions 。
- 我已在现有问题中搜索 search for existing issues ,包括已关闭的问题。
- 我确认我使用英文提交此报告(我已阅读并同意 Language Policy )。
- 请务必使用英文提交问题,否则会被关闭。谢谢!:)
- 请不要修改此模板 :) 并填写所有必填字段。
Dify版本
0.6.13
云或自托管
自托管(Docker)
重现步骤
当大型模型类型是连续大型模型时,内置提示词组装中的错误导致大型模型异常返回。重现步骤:
- 将 codeqwen1.5 添加为代码连续大型模型。
- 添加一个文本生成应用程序,将 codeqwen1.5 选择为代码连续大型模型。
- 将提示词设置为:<fim_prefix>{{code_pre}}<fim_suffix>{{code_sur}}<fim_middle>
- 为 code_pre 和 code_sur 输入任何文本,点击生成,大型模型收到的提示词将变为:
<fim_prefix>xxxxxx<fim_suffix>xxxxxxx<fim_middle>
{{#query#}}
原因:
在 core\prompt\simple_prompt_transform.py 文件中,get_prompt_template 方法在组装提示词时存在逻辑错误。当类型为 COMPLETION 或 WORKFLOW 时,没有查询变量,但仍然连接了
和 {{#query#}}。
✔️ 预期行为
正确的提示应该是:
<fim_prefix>xxxxxx<fim_suffix>xxxxxxx<fim_middle>
❌ 实际行为
大型模型收到的提示是:
<fim_prefix>xxxxxx<fim_suffix>xxxxxxx<fim_middle>
{{#query#}}
2条答案
按热度按时间wwtsj6pe1#
要解决Dify版本0.6.13中
core\prompt\simple_prompt_transform.py
方法在codeqwen1.5
模型的提示中错误地将\n{{#query#}}
附加到codeqwen1.5
的问题,您需要修改get_prompt_template
方法以专门处理codeqwen1.5
模型。以下是更新后的代码:def get_prompt_template(self, app_mode: AppMode,
provider: str,
model: str,
pre_prompt: str,
has_context: bool,
query_in_prompt: bool,
with_memory_prompt: bool = False) -> dict:
prompt_rules = self._get_prompt_rule(
app_mode=app_mode,
provider=provider,
model=model
)
8wigbo562#
请随时提交一个pull request。:)