tongyi response format use a trick way not model parameters #567

Closed
opened 2026-02-16 10:19:45 -05:00 by yindo · 1 comment
Owner

Originally created by @jiangbo721 on GitHub (Aug 17, 2025).

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 Dify issues & Dify Official Plugins, 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

1.4.1

Plugin version

0.3.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image Image Image

✔️ Error log

No response

Originally created by @jiangbo721 on GitHub (Aug 17, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.4.1 ### Plugin version 0.3.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce <img width="551" height="672" alt="Image" src="https://github.com/user-attachments/assets/bb4c514b-cb5a-45a3-876f-c22675caf43a" /> <img width="1091" height="219" alt="Image" src="https://github.com/user-attachments/assets/5d574b36-3bfd-4f9c-94d3-0abaf8cf058c" /> <img width="1381" height="465" alt="Image" src="https://github.com/user-attachments/assets/7839d4d9-1949-493b-aebd-4181a478644f" /> ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:19:45 -05:00
yindo closed this issue 2026-02-16 10:19:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 17, 2025):

You're correct—recent updates to the Tongyi (Qwen) plugin (v0.3.0) changed how response formats are handled. Instead of passing a response_format as a direct model parameter, the plugin now uses template-based or custom post-processing logic to shape the output (the "trick way") because some Tongyi models don't natively support switching formats via parameters. This means the plugin adapts the model's output after inference to match JSON, XML, etc., as needed, rather than relying on the model to do it itself. This shift is confirmed by the removal of response_format from several model YAML files in PR #1209.

There are known issues with this approach, especially with JSON output—sometimes the returned data is invalid or missing quotes due to quirks in the incremental output and post-processing logic (see issue #458). If you need reliable JSON, you may need to add extra validation or post-processing in your workflow.

This workaround is necessary due to Tongyi's API limitations, and while it can introduce compatibility concerns, it's currently the only way to support flexible response formats for these models in Dify.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Aug 17, 2025): <!-- Answer --> You're correct—recent updates to the Tongyi (Qwen) plugin (v0.3.0) changed how response formats are handled. Instead of passing a `response_format` as a direct model parameter, the plugin now uses template-based or custom post-processing logic to shape the output (the "trick way") because some Tongyi models don't natively support switching formats via parameters. This means the plugin adapts the model's output after inference to match JSON, XML, etc., as needed, rather than relying on the model to do it itself. This shift is confirmed by the removal of `response_format` from several model YAML files in [PR #1209](https://github.com/langgenius/dify-official-plugins/pull/1209). There are known issues with this approach, especially with JSON output—sometimes the returned data is invalid or missing quotes due to quirks in the incremental output and post-processing logic ([see issue #458](https://github.com/langgenius/dify-official-plugins/issues/458)). If you need reliable JSON, you may need to add extra validation or post-processing in your workflow. This workaround is necessary due to Tongyi's API limitations, and while it can introduce compatibility concerns, it's currently the only way to support flexible response formats for these models in Dify. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/af5c2abc-c934-4295-b323-228c963b192d?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1524)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#567