Replies: 1 comment
-
|
Hi @wanghq032! I'm Dosu and I’m helping the dify team. This is a known serialization issue in Dify when using multimodal models like Qwen2.5-VL-72B-Instruct with SiliconFlow. The error happens when ImagePromptMessageContent objects (which represent images in the workflow) are not properly converted to a JSON-serializable format before being sent to the plugin or model. Dify normally handles this with its jsonable_encoder, but the error can occur if image variables are included in the System Prompt, or if the plugin/integration skips this conversion step. To ensure images are correctly connected and processed:
If you still see the error, double-check that your image data is correctly formatted and that your workflow does not include image variables in the System Prompt. If you need to debug further, log the serialized prompt messages before they are sent to the plugin to ensure all image objects are properly converted to dicts. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
我试图在 Dify 工作流中使用 硅基流动(SiliconFlow) 的 Qwen/Qwen2.5-VL-72B-Instruct 模型来识别用户上传的发票图片内容。我已在工作流中配置了图像上传节点,并将图像输出正确连接到 SiliconFlow 节点的图像输入端口。然而,当我运行工作流时,系统返回以下错误:
text
[siliconflow] Error: req_id: 295833e6c5 PluginInvokeError: {"args":{"description":"[models] Error: Object of type ImagePromptMessageContent is not JSON serializable"},"error_type":"InvokeError","message":"[models] Error: Object of type ImagePromptMessageContent is not JSON serializable"}
这让人沮丧,因为 Qwen2.5-VL-72B-Instruct 是一个明确支持视觉的多模态模型,理论上应该能处理图像输入。我不确定是哪个环节的参数配置错误,或是图像连接方式有误。
2. Additional context or comments
模型:Qwen/Qwen2.5-VL-72B-Instruct
平台:Dify Cloud + SiliconFlow
任务类型:视觉理解(发票识别)
图像上传方式:通过 Dify 文件上传节点,输出连接到 SiliconFlow 节点的图像输入端口
错误发生节点:SiliconFlow 节点
期望行为:模型应正确接收图像并返回文字识别结果
相关文件信息:
json
{
"filename": "发票.jpg",
"mime_type": "image/jpeg",
"transfer_method": "local_file"
}
我想知道:
如何在 Dify 工作流中确保上传的图片已正确连接到 SiliconFlow 节点的图像输入端口?
为了让模型正确“看懂”图像,哪些参数必须设置正确?
这是否是一个已知的兼容性或序列化问题?
Beta Was this translation helpful? Give feedback.
All reactions