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

When using moonshot, setting the value of response_format to json_object results in a call error. #9785

Closed
5 tasks done
wadezyj opened this issue Oct 24, 2024 · 1 comment · Fixed by #9847
Closed
5 tasks done
Labels
🐞 bug Something isn't working

Comments

@wadezyj
Copy link

wadezyj commented Oct 24, 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.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using moonshot, setting the value of response_format to json_object results in a call error.
The error message is:
"[moonshot] Error: API request failed with status code 400: {"error":{"message":"Invalid request: the response_format field in the request (expected type object) is illegal, and string is not acceptable","type":"invalid_request_error"}}"

✔️ Expected Behavior

No error

❌ Actual Behavior

"[moonshot] Error: API request failed with status code 400: {"error":{"message":"Invalid request: the response_format field in the request (expected type object) is illegal, and string is not acceptable","type":"invalid_request_error"}}"

Copy link

dosubot bot commented Oct 24, 2024

@wadezyj Hello there! I'm here to help you with bugs, questions, and becoming a contributor. Let's solve this together while we wait for a human maintainer.

The error you're encountering is due to the response_format field being set to a value that is not accepted by the Dify system. According to the Dify codebase, the accepted values for the response_format field are:

  • "json_schema": This requires an accompanying json_schema to be defined and correctly formatted.
  • Any other string value, which will be set as the type in the response_format dictionary [1].

The error message indicates that the system expected an object type for response_format, but received a string instead. To resolve this, ensure that the response_format is set to a valid value, such as "json_schema" with a proper JSON schema, or another accepted string value. If "json_object" is not a recognized value, you may need to adjust it to one of the accepted formats.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Oct 24, 2024
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