mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
OpenAI-API-compatible Model throws "Non-JSON encountered." error #45
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TinyFatty on GitHub (Mar 6, 2025).
Self Checks
Dify version
1.0.0
Plugin version
Built-in LLM block(I don't see any version here)
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Self Checks
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I used OpenAI-API-compatible Models (offered by China Telecom) in workflow LLM blocks and it throws "Non-JSON encountered." error (3 blocks share the same configuration, Deepseek official api and Silconflow deepseek api return the correct answer).
Here is the configuration for all
Here is the error message
OUTPUT data:
It takes only 1 second and no token is used,so I think the error occurs before the model starts reasoning.
Then I tested this model with python scripts
It shows the corrent answer
{"code":0,"id":"chatcmpl-00-89c57718adba43dd5650511e4ecece0f-ba26f79321d736fa-01","choices":[{"index":0,"message":{"content":"<think>\nGreetings! I'm DeepSeek-R1, an artificial intelligence assistant created by DeepSeek. I'm at your service and would be delighted to assist you with any inquiries or tasks you may have.\n</think>\n\nGreetings! I'm DeepSeek-R1, an artificial intelligence assistant created by DeepSeek. I'm at your service and would be delighted to assist you with any inquiries or tasks you may have.","role":"assistant"},"finish_reason":"stop"}],"created":1741254044,"model":"DeepSeek-R1","object":"chat.completion","usage":{"completion_tokens":83,"prompt_tokens":16,"total_tokens":99}}Is there any special configuration I missed for OpenAI-API-compatible Model?
✔️ Error log
OUTPUT data:
@TinyFatty commented on GitHub (Mar 6, 2025):
Additional Information。
I rolled back to ver 0.15.3. The same model worked fine.
So I think maybe ver 1.0.0 changed something and didn't mention it.
@ccll commented on GitHub (Mar 6, 2025):
Same here with 1.0.0, and works as @TinyFatty says in 0.15.3
The model API works with
curland the returned streaming JSONL is correct.@oiisongyu commented on GitHub (Mar 13, 2025):
Same here.
In the Dify version 1.0.0 and above, there is a new parameter named "API endpoint中的模型名称" in the openai-api-compatible configuration page. However, in version 0.15.3, this parameter doesn't exist, and the Q&A functionality works properly.
@zouxiaodong commented on GitHub (Mar 14, 2025):
same here
@westdata commented on GitHub (Mar 15, 2025):
same here
@zouxiaodong commented on GitHub (Mar 16, 2025):
same error after upgrading to version 1.0.1, model using ctyun xirang deepseek-r1 :https://www.ctyun.cn/act/xirang/deepseek
@Lamber-maybe commented on GitHub (Mar 17, 2025):
same here
@zouxiaodong commented on GitHub (Mar 17, 2025):
The root cause of the issue is that the data returned by Ctyun Xirang does not include a space after "data:". However, the source code currently assumes that there will be a space after "data:". To fix this, we can modify the source code to remove the dependency on the space after "data:", ensuring compatibility with the data format provided by Ctyun Xirang.
@lastchiliarch commented on GitHub (Mar 20, 2025):
same problem. any progress?
@XiaoCC commented on GitHub (Mar 24, 2025):
提交一个pr修复吧
@Aniwine commented on GitHub (Mar 25, 2025):
Hi, thanks for your solution, but where is the file?
@Aniwine commented on GitHub (Mar 26, 2025):
I have already solved it by this method, in plugin-daemon's container,find the openai_compatible's llm.py of the package called dify-plugin,which located in langgenius/openai_api_compatible-0.0.11@410445eba2fa0f693d26dea2c3b9ffe51ad0777e021146ff877af6098412efc7/.venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible/llm.py.Then modify it as above, it works for me!!
@Osama-Faza commented on GitHub (Jun 15, 2025):
I'm facing this issue on the cloud Dify website, version 1.4.2.
Is there anything I can do to fix the problem from my end, or do I have to wait for a pull request to be made and merged?
@dwdcth commented on GitHub (Jul 14, 2025):
Same here.
Please solve it
@shun-qi commented on GitHub (Jul 22, 2025):
same here
please !!!!!
@dosubot[bot] commented on GitHub (Aug 21, 2025):
Hi, @TinyFatty. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!