mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"KeyError","message":"'choices'"} #262
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 @Kevinhuhu on GitHub (May 8, 2025).
Self Checks
Dify version
1.3.1
Cloud or Self Hosted
Self Hosted (Docker), Cloud
Steps to reproduce
After updating to version 1.3.1, using the openai_api_compatible plugin to call OpenAI API-compatible endpoints results in errors. This worked properly before version 1.3.1. The same error persists even when trying other OpenAI API-compatible endpoints.
Error details:
Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"KeyError","message":"'choices'"}
✔️ Expected Behavior
Expected to return properly.
❌ Actual Behavior
Run failed: [openai_api_compatible] Error: PluginInvokeError: {"args":{},"error_type":"KeyError","message":"'choices'"}
but use other tool(like postman),the api return like:
{
"id": "my_chatId",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "\n# 抖音会员通功能详解\n\n抖音会员通是系统与抖音平台深度整合的会员管理解决方案,帮助商家实现抖音流量到私域会员的高效转化。\n\n## 主要功能亮点\n\n1. 会员体系双向打通\n - 自动同步抖音会员到银豹系统\n - 会员数据实时更新\n\n2. 智能会员管理\n - 自动识别新老会员\n - 支持自定义会员标签\n - 会员消费行为追踪\n\n3. 营销工具整合\n - 会员专享商品设置\n - 精准营销活动推送\n - 团购券核销一体化\n\n## 典型应用场景\n\n1. 会员获取\n - 设置"会员专享品",吸引用户入会\n - 非会员需先入会才能购买特定商品\n\n2. 会员运营\n - 根据消费行为进行会员分层\n - 推送个性化营销活动\n - 提升复购率和客单价\n\n3. 数据洞察\n - 分析会员消费偏好\n - 优化商品结构和营销策略\n\n## 开通流程\n\n1. 联系抖音BD开通会员通服务\n2. 在银豹后台完成配置:\n - 路径:营销 > 抖音团购 > 会员通\n - 设置自动打标规则\n - 配置会员专享商品\n\n## 成功案例\n\n某品牌使用后效果:\n- 单周GMV突破4万元\n- 2周新增会员3000+\n- 会员复购率提升35%\n\n如需详细了解配置方法,可参考[官方接入指南]。"
},
"finish_reason": "stop",
"index": 0
}
]
}
@dosubot[bot] commented on GitHub (May 8, 2025):
The
KeyErrorrelated to the'choices'field in theopenai_api_compatibleplugin suggests that the plugin is attempting to access the'choices'field in the API response, but it is not finding it. This issue might be due to changes in how the plugin processes API responses in version 1.3.1.To handle this, ensure that the plugin is correctly configured to parse the API response structure. The
openai_api_compatibleplugin should expect a response structure that includes achoicesfield, which is a list ofChatCompletionChoiceobjects. Each object should contain amessagewith content and other attributes [1].Here are a few steps you can take to troubleshoot and resolve the issue:
Verify Response Structure: Ensure that the API response from the OpenAI API-compatible endpoint includes the
choicesfield as expected. The response should match the structure you provided in your example.Check Plugin Configuration: Review the plugin's configuration to ensure it is set up to handle the expected response format. This includes verifying any recent changes in the plugin's code that might affect how it processes the
choicesfield.Error Handling: Consider implementing error handling in the plugin to gracefully manage cases where the
choicesfield might be missing or malformed. This can preventKeyErrorexceptions from disrupting the plugin's operation.Review Recent Changes: If the issue arose after updating to version 1.3.1, review the release notes or change logs for any modifications that might affect the plugin's behavior.
If these steps do not resolve the issue, you may need to investigate further into the plugin's code or consult with the development team for more specific guidance.
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
@Kevinhuhu commented on GitHub (May 9, 2025):
It appears to be an issue with streaming output. Can the openai_api_compatible support a parameter to disable streaming output? Previous versions seemed to default to non-streaming output.
@dosubot[bot] commented on GitHub (Aug 18, 2025):
Hi, @Kevinhuhu. 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!