Closed mingkwind closed 2 months ago
tool 还不支持 azure openai
截至现在问题依然存在,我来分析一下并提供一个Workaround。
目前pypi上chatgpt-tool-hub
的最新版本(0.4.4)在构造模型参数字典的时候没有考虑deployment_id
,导致后续OpenAI的Python库在初始化时认为参数缺失而报错。
在 https://github.com/goldfishh/chatgpt-tool-hub/commit/96a98f6f0f0561e76d0f316ec2423b644498e718 中,作者已经修复了这个问题,然而pypi上并没有同步这个更新,依然停留在2023/5/15的版本。所以使用pip安装的依赖仍然存在该问题。
丑陋,但是能用。特殊情况下不适用(tool插件下的url-get
、summary
等工具在新建模型的时候不会被这个覆盖到。考虑不修改依赖代码的情况,只能做到这个地步了)
将 /plugins/tool/tool.py
中_reset_app()
的 返回语句:
return app.create_app(tools_list=tool_list, **app_kwargs)
改为:
patched_app = app.create_app(tools_list=tool_list, **app_kwargs)
patched_app .llm.model_kwargs['deployment_id'] = tool_config['kwargs']['deployment_id']
return patched_app
然后在/plugins/tool/config.json
中加入一行:
{
"tools": [
"python",
"url-get",
"terminal",
"meteo-weather"
],
"kwargs": {
// .....
// 在这里加入你的模型部署ID
"deployment_id": "gpt35"
}
}
前置确认
⚠️ 搜索issues中是否已存在类似问题
操作系统类型?
Railway
运行的python版本是?
python 3.7
使用的chatgpt-on-wechat版本是?
Latest Release
运行的
channel
类型是?wx(个人微信, itchat)
复现步骤 🕹
我已经设置好了azure api的各项参数,微信机器人也能顺利对话,但是在使用$tool命令的时候遇到错误,railway后台日志显示如下:
问题描述 😯
终端日志 📒