Dify添加模型max_tokens_too_small异常

环境信息

Dify版本:1.10.1

插件版本:OpenAI-API-compatible 0.0.36

异常问题

添加自定义模型出现 {"error":{"code":"max_tokens_too_small","message":"max_tokens must be at least 10 (request id: xxxxx)"}} 错误;

异常问题

通过GitHub提问,目前是已知问题:与 OpenAl-API 兼容的插件在进行凭证验证时使用了固定的“max_tokens: 5”设置,低于许多模型所要求的最小令牌数5;

修改方法

docker部署解决方案:

找到映射的目录文件:

docker/volumes/plugin_daemon/cwd/langgenius/openai_api_compatible-0.0.**@**/.venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible/llm.py

找到 validate_credentials_max_tokens = credentials.get("validate_credentials_max_tokens", 5) or 5 进行修改

修改为5为16或者更高,就可以解决这个问题。

参考文档

issues 1694

issues 2710

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论