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

Run failed: [google] Error: The user prompt message is required. You only add a system prompt message. #12244

Closed
5 tasks done
toptalentsgpt opened this issue Dec 31, 2024 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@toptalentsgpt
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

{
"model_mode": "chat",
"prompts": [
{
"role": "system",
"text": "xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。",
"files": []
}
],
"model_provider": "google",
"model_name": "gemini-2.0-flash-exp"
}

Shows :Run failed: [google] Error: The user prompt message is required. You only add a system prompt message.

image

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Copy link

dosubot bot commented Dec 31, 2024

To resolve the error "Run failed: [google] Error: The user prompt message is required. You only add a system prompt message" in your self-hosted Dify setup, you need to include a user prompt message in your prompt configuration. The error occurs because the model expects at least one message with the role "user" in the prompt messages.

Here's how you can structure your prompt messages to include a UserPromptMessage:

{
  "model_mode": "chat",
  "prompts": [
    {
      "role": "user",
      "text": "Your user prompt here"
    },
    {
      "role": "system",
      "text": "```xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n```\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。"
    }
  ],
  "model_provider": "google",
  "model_name": "gemini-2.0-flash-exp"
}

Make sure to replace "Your user prompt here" with the actual user input or query you want to process. This should resolve the error by ensuring that the prompt messages include a user role message [1].

To continue talking to Dosu, mention @dosu.


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

@dosubot dosubot bot added the 🐞 bug Something isn't working label Dec 31, 2024
@hjlarry
Copy link
Contributor

hjlarry commented Dec 31, 2024

image

This field is required now

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