Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行报错:module 'openai.error' has no attribute 'Timeout'等“找不到属性”问题 #367

Closed
GZYZhy opened this issue Mar 6, 2023 · 3 comments

Comments

@GZYZhy
Copy link

GZYZhy commented Mar 6, 2023

问题:

成功部署并登陆微信账号后,收到消息时报错:

[ERROR][2023-03-06 11:20:51][wechat_channel.py:121] - module 'openai.error' has no attribute 'Timeout'
Traceback (most recent call last):
  File "/opt/chatgpt/bot/chatgpt/chat_gpt_bot.py", line 60, in reply_text
    response = openai.ChatCompletion.create(
AttributeError: module 'openai' has no attribute 'ChatCompletion'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/chatgpt/channel/wechat/wechat_channel.py", line 117, in _do_send
    reply_text = super().build_reply_content(query, context)
  File "/opt/chatgpt/channel/channel.py", line 31, in build_reply_content
    return Bridge().fetch_reply_content(query, context)
  File "/opt/chatgpt/bridge/bridge.py", line 9, in fetch_reply_content
    return bot_factory.create_bot("chatGPT").reply(query, context)
  File "/opt/chatgpt/bot/chatgpt/chat_gpt_bot.py", line 42, in reply
    reply_content = self.reply_text(new_query, from_user_id, 0)
  File "/opt/chatgpt/bot/chatgpt/chat_gpt_bot.py", line 87, in reply_text
    except openai.error.Timeout as e:
AttributeError: module 'openai.error' has no attribute 'Timeout'

环境

  • 操作系统类型 :linux-centos7.9
  • Python版本: python3.6.8
  • pip版本:pip 9.0.3
  • 实例中的部署路径:/opt/chatgpt
@GZYZhy GZYZhy changed the title 运行报错:module 'openai.error' has no attribute 'Timeout' 运行报错:module 'openai.error' has no attribute 'Timeout'等“找不到”问题 Mar 6, 2023
@GZYZhy GZYZhy changed the title 运行报错:module 'openai.error' has no attribute 'Timeout'等“找不到”问题 运行报错:module 'openai.error' has no attribute 'Timeout'等“找不到属性”问题 Mar 6, 2023
@reBiocoder

This comment was marked as off-topic.

@zhayujie
Copy link
Owner

zhayujie commented Mar 6, 2023

更新下openai版本,需要0.27.0 以上

pip3 install --upgrade openai

@xBeTe
Copy link

xBeTe commented Mar 6, 2023

"Requires: Python >=3.7.1" Python 版本 要3.7.1 以上,才能安装 openai 0.27.0 。

@zhayujie zhayujie closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants