zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT4.0/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
28.4k stars 7.55k forks source link

module 'google.generativeai' has no attribute 'GenerativeModel' #1600

Open Eddiee-Wei opened 7 months ago

Eddiee-Wei commented 7 months ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Linux

运行的python版本是?

python 3.8

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wx(个人微信, itchat)

复现步骤 🕹

When using the Google-Gemini framework, encountering a problem will show this.

问题描述 😯

Start auto replying. [INFO][2023-12-15 23:11:51][chat_channel.py:115] - [WX]receive group at [INFO][2023-12-15 23:11:51][bridge.py:49] - create bot gemini for chat [INFO][2023-12-15 23:11:51][google_gemini_bot.py:34] - [Gemini] query=who are you [ERROR][2023-12-15 23:11:51][google_gemini_bot.py:46] - [Gemini] fetch reply error, may contain unsafe content [ERROR][2023-12-15 23:11:51][google_gemini_bot.py:47] - module 'google.generativeai' has no attribute 'GenerativeModel'

终端日志 📒

[INFO][2023-12-15 23:10:13][config.py:245] - [INIT] load config: {'channel_type': 'wx', 'open_ai_api_key': 'YOUR API KEY', 'model': 'gemini', 'baidu_wenxin_model': 'eb-instant', 'baidu_wenxin_api_key': '', 'baidu_wenxin_secret_key': '', 'gemini_api_key': '**', 'text_to_image': 'dall-e-2', 'voice_to_text': 'openai', 'text_to_voice': 'openai', 'proxy': '', 'hot_reload': False, 'single_chat_prefix': ['bot', '@bot'], 'single_chat_reply_prefix': '', 'group_chat_prefix': ['@bot'], 'group_name_white_list': **, 'image_create_prefix': ['画'], 'speech_recognition': True, 'group_speech_recognition': False, 'voice_reply_voice': False, 'tts_voice_id': 'alloy', 'conversation_max_tokens': 1000, 'expires_in_seconds': 3600, 'character_desc': '你是GPT, 大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。', 'temperature': 0.7, 'top_p': 1, 'subscribe_msg': '感谢您的关注!\n这里是GPT,可以自由对话。\n支持语音对话。\n支持图片输入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。', 'use_linkai': False, 'linkai_api_key': '', 'linkai_app_code': ''} [INFO][2023-12-15 23:10:13][config.py:193] - [Config] User datas loaded. [WARNING][2023-12-15 23:10:13][audio_convert.py:9] - import pysilk failed, wechaty voice message will not be supported. [INFO][2023-12-15 23:10:13][plugin_manager.py:50] - Loading plugins config... [INFO][2023-12-15 23:10:13][plugin_manager.py:88] - Scaning plugins ... [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins/role [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins/dungeon [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins/finish [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin linkai_v0.1.0 registered, path=./plugins/linkai [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins/keyword [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins/hello [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins/bdunit [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins/godcmd [INFO][2023-12-15 23:10:13][plugin_manager.py:41] - Plugin tool_v0.4 registered, path=./plugins/tool [INFO][2023-12-15 23:10:13][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为5423。 [INFO][2023-12-15 23:10:13][godcmd.py:210] - [Godcmd] inited [INFO][2023-12-15 23:10:13][keyword.py:40] - [keyword] {} [INFO][2023-12-15 23:10:13][keyword.py:42] - [keyword] inited. [INFO][2023-12-15 23:10:13][linkai.py:33] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群名2': 'Kv2fXJcH'}, 'midjourney': {'enabled': False, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': False, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}} [INFO][2023-12-15 23:10:13][role.py:69] - [Role] inited [INFO][2023-12-15 23:10:13][dungeon.py:56] - [Dungeon] inited [INFO][2023-12-15 23:10:13][hello.py:24] - [Hello] inited [INFO][2023-12-15 23:10:13][finish.py:23] - [Finish] inited [INFO][2023-12-15 23:11:38][wechat_channel.py:126] - Wechat login success, user_id: @e53329b99d9c91b28ea2011b351570e3c73151e69d0eb7f7094aa4badce5ce8e, nickname: test [INFO][2023-12-15 23:11:51][chat_channel.py:115] - [WX]receive group at [INFO][2023-12-15 23:11:51][bridge.py:49] - create bot gemini for chat [INFO][2023-12-15 23:11:51][google_gemini_bot.py:34] - [Gemini] query=who are you [ERROR][2023-12-15 23:11:51][google_gemini_bot.py:46] - [Gemini] fetch reply error, may contain unsafe content [ERROR][2023-12-15 23:11:51][google_gemini_bot.py:47] - module 'google.generativeai' has no attribute 'GenerativeModel' [INFO][2023-12-15 23:12:31][app.py:17] - signal 2 received, exiting... [INFO][2023-12-15 23:12:31][config.py:204] - [Config] User datas saved.

Reachan0 commented 7 months ago

python更新到3.9以上再pip安装下依赖即可

huangzhitian commented 7 months ago

一样,问它是谁,就不回答了,过于敏感了 image

zyang9 commented 7 months ago

手动装好grpcio依赖后仍有错误: [ERROR][2023-12-16 01:07:08][google_gemini_bot.py:45] - [Gemini] fetch reply error, may contain unsafe content
[ERROR][2023-12-16 01:07:08][google_gemini_bot.py:46] - 'NoneType' object has no attribute 'from_call'

Eddiee-Wei commented 7 months ago

python更新到3.9以上再pip安装下依赖即可

question of "[ERROR][2023-12-15 23:47:40][google_gemini_bot.py:47] - module 'google.generativeai' has no attribute 'GenerativeModel'" still alive~

zyang9 commented 7 months ago

python更新到3.9以上再pip安装下依赖即可

question of "[ERROR][2023-12-15 23:47:40][google_gemini_bot.py:47] - module 'google.generativeai' has no attribute 'GenerativeModel'" still alive~

要把python3.9设为默认

Eddiee-Wei commented 7 months ago

python更新到3.9以上再pip安装下依赖即可

question of "[ERROR][2023-12-15 23:47:40][google_gemini_bot.py:47] - module 'google.generativeai' has no attribute 'GenerativeModel'" still alive~

要把python3.9设为默认

Problem has already been solved, but [INFO][2023-12-16 00:36:44][google_gemini_bot.py:34] - [Gemini] query=你厉害还是ChatGPT厉害 [ERROR][2023-12-16 00:36:49][google_gemini_bot.py:46] - [Gemini] fetch reply error, may contain unsafe content [ERROR][2023-12-16 00:36:49][google_gemini_bot.py:47] - list index out of range [INFO][2023-12-16 00:37:02][chat_channel.py:115] - [WX]receive group at [INFO][2023-12-16 00:37:02][google_gemini_bot.py:34] - [Gemini] query=你厉害还是ChatGPT厉害 [ERROR][2023-12-16 00:37:07][google_gemini_bot.py:46] - [Gemini] fetch reply error, may contain unsafe content [ERROR][2023-12-16 00:37:07][google_gemini_bot.py:47] - list index out of range [INFO][2023-12-16 00:37:43][chat_channel.py:115] - [WX]receive group at [INFO][2023-12-16 00:37:43][google_gemini_bot.py:34] - [Gemini] query=@为什么list index out of range

what are reasons of these questions (list index out of range) ? (thx a lot!

zhayujie commented 7 months ago

1、需要安装依赖: pip3 install google-generativeai 2、gemini 的敏感词很严格,"gpt", "openai"这些都是敏感词,具体可以在官方playgroud试验

image
joyce677 commented 7 months ago

1、需要安装依赖: pip3 install google-generativeai 2、gemini 的敏感词很严格,"gpt", "openai"这些都是敏感词,具体可以在官方playgroud试验 image

[ERROR][2023-12-16 14:41:07][google_gemini_bot.py:40] - Deadline of 60.0s exceeded while calling target function, last exception: 503 failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.161.42:443: socket is null

lzx4627 commented 6 months ago

docker版本依旧缺少google.generativeai模块,需要手动进到docker容器内部安装

limaolin2017 commented 6 months ago

railway版本也缺少google.generativeai模块,如何手动在railway安装?

PS:已经尝试修改了requirements.txt 添加了google.generativeai,仍旧出现相同的错误。