dify icon indicating copy to clipboard operation
dify copied to clipboard

Error 400: 'stop' parameter not supported by o4-mini` model

Open MitraSafarinejad opened this issue 8 months ago • 3 comments

Self Checks

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

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I have updated the OpenAI plugin, which added two O4-Mini models. When I try to use both models, I encounter the following error:

[models] Bad Request Error, Error code: 400 - {'error': {'message': "Unsupported parameter: 'stop' is not supported with this model.", 'type': 'invalid_request_error', 'param': 'stop', 'code': 'unsupported_parameter'}}

Image

✔️ Expected Behavior

The model should work fine without returning an error.

❌ Actual Behavior

The model returns a 400 Bad Request error with the message indicating that the stop parameter is not supported.

MitraSafarinejad avatar Apr 28 '25 07:04 MitraSafarinejad

The error you're encountering is due to the 'stop' parameter not being supported by the O4-Mini model. In the Dify codebase, the ModelConfigConverter class processes model configurations and removes unsupported parameters like 'stop' before finalizing the configuration [1].

To resolve this issue, you can modify the configuration to exclude the 'stop' parameter when using the O4-Mini model. This involves ensuring that the 'stop' parameter is not included in the completion parameters for these models. If you have control over the code where the model is invoked, you can adjust the parameters accordingly to prevent the 'stop' parameter from being passed to the O4-Mini model.

To continue talking to Dosu, mention @dosu.


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

dosubot[bot] avatar Apr 28 '25 07:04 dosubot[bot]

Can you export the DSL? I tried the model you mentioned above, but I can not reproduce this error.

Image

crazywoola avatar Apr 28 '25 07:04 crazywoola

I create an agent, here is my DSL

test mitra.zip

MitraSafarinejad avatar Apr 28 '25 10:04 MitraSafarinejad

Hello, I have upgrade the plugin in this pr https://github.com/langgenius/dify-official-plugins/pull/820.

Please upgrade openai to v0.0.22 later.

crazywoola avatar Apr 29 '25 06:04 crazywoola

@crazywoola I am using the openai-api-compatible plugin and the third-party o4 api, and this error is also reported. Can you backport it?

rty813 avatar May 19 '25 02:05 rty813