其实是和以前一样的处理方式,(挂魔法修改代理,但是openai源码改了,好多博客的方法不能用了。现在给一个新的修改方式自己用的,发现可以
1.找到pip下载openai的Lib找到_base_client.py这个文件
在这里插入图片描述
2.找到_base_client.py文件中的BaseClient类,把init中原本的self._proxies=proxies修改图片中的内容

self._proxies = {'http': 'http://localhost:7890','https': 'http://localhost:7890'}

在这里插入图片描述
3.最后自己测试文件加入两行代码

import os
os.environ["http_proxy"] = "http://localhost:7890"
os.environ["https_proxy"] = "http://localhost:7890"

在这里插入图片描述

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注