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

In the workflow's llm node, if the system prompts that there are variables in the text, the execution will report an error #11979

Closed
5 tasks done
wangiii opened this issue Dec 23, 2024 · 1 comment · Fixed by #11984
Labels
🐞 bug Something isn't working

Comments

@wangiii
Copy link
Contributor

wangiii commented Dec 23, 2024

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.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

image

✔️ Expected Behavior

If there are variables in the system prompt words, the variables should be replaced with actual values ​​and the replaced strings should be input into the big model.

❌ Actual Behavior

image Content input is an array,this should be a string.
Copy link

dosubot bot commented Dec 23, 2024

The issue you're encountering seems to be related to how variables within system prompts are handled and replaced in the Dify workflow. In the LLM node, the message.content should be a string, but it appears to be an array of TextPromptMessageContent objects instead. This discrepancy is likely causing the "Bad Request Error" with error code 400.

To resolve this, ensure that the variables in the system prompt are correctly replaced with actual values before being passed to the LLM node. The message.content should be a single string after variable replacement, not an array. You might need to adjust the code to concatenate the data attributes of the TextPromptMessageContent objects into a single string before assigning it to message.content.

Additionally, verify that all required parameters, such as messages[0].content[0].type, are correctly set in the request payload. This will help prevent the "Missing required parameter" error.

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 23, 2024
@wangiii wangiii mentioned this issue Dec 23, 2024
5 tasks
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

Successfully merging a pull request may close this issue.

1 participant