langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
49.14k stars 7.04k forks source link

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

Open wadezyj opened 2 hours ago

wadezyj commented 2 hours ago

Self Checks

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\"}}"

dosubot[bot] commented 2 hours ago

@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:

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.