Gemini大模型初体验
1 使用体验
- 同样需要科学上网。
- 速度很快,而且还不要钱,据说使用太多可能被限流。
- 对于小语种翻译效果比 GPT-4 好,其它还没测试。
- 可通过 ChatBox 界面调用,也可使用 Python 调用。
2 使用 ChatBox 方式调用
- 在 build with gemini 申请一个 apikey
- 设置本机代理
- 下载 ChatBox,并设置模型为 gimini 和 apikey
- 参考:https://mp.weixin.qq.com/s/Dvc1TU554Kv68OiVp1C6UA
3 使用 Python 调用 Gimini
3.1 安装库
shell
1 | pip install -q -U google-generativeai |
3.2 代码
shell
1 | import google.generativeai as genai |
3.3 设置代理
测试使用 os.environ 环境变量方式设置代理无效,然后我修改了 grpc 代码,就可正常使用了:
shell
1 | vi /usr/local/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/transports/grpc_asyncio.py |
上述两个文件都要修改 options 如下:
python
1 | options=[ |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.