jiran214 / GPT-vup

GPT-vup BIliBili | 抖音 | AI | 虚拟主播
1.19k stars 184 forks source link

test_net 时测试 openai 库失败 #10

Open luchaoshi45 opened 1 year ago

luchaoshi45 commented 1 year ago

PS C:\Users\63568\Desktop\GPT-vup> & 'C:\Users\63568\AppData\Local\Microsoft\WindowsApps\python3.11.exe' 'c:\Users\63568.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '53845' '--' 'C:\Users\63568\Desktop\GPT-vup\src\manager.py' 'run' 'bilibili' Retrying langchain.llms.openai.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised RateLimitError: Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact us through our help center at help.openai.com.. Retrying langchain.llms.openai.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised RateLimitError: Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact us through our help center at help.openai.com.. Retrying langchain.llms.openai.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised RateLimitError: Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact us through our help center at help.openai.com.. Retrying langchain.llms.openai.completion_with_retry.._completion_with_retry in 8.0 seconds as it raised RateLimitError: Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact us through our help center at help.openai.com.. PS C:\Users\63568\Desktop\GPT-vup>

luchaoshi45 commented 1 year ago

挂上梯子可以打开 gpt

测试外网环境(vscode 调试正常)

    r = requests.get(url='https://www.youtube.com/', verify=False, proxies={
        'http': f'http://{config.proxy}/',
        'https': f'http://{config.proxy}/'
    })
    assert r.status_code == 200

测试openai库(调试失败)

    llm = OpenAI(temperature=config.temperature, openai_api_key=get_openai_key(), verbose=config.debug)
    text = "python是世界上最好的语言 "
    print(llm(text))
    print('测试成功!')
jiran214 commented 1 year ago

貌似你openai一分钟请求超过3次,请求太频繁了,openai有频率限制

anhao commented 1 year ago

可以使用 https://aigc2d.com 这个平台,支持GPT3.5 GPT4.0接口

fckcg commented 1 year ago

我的也是一样,你有解决吗?

fckcg commented 1 year ago

Retrying langchain.llms.openai.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/completions (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1131)'))).

fckcg commented 1 year ago

我的提示这个,一直失败

anhao commented 1 year ago

我的提示这个,一直失败 这个api.openai.com 在国内是不能正常使用的,可以使用 https://aigc2d.com/ 这个平台来替换api.openai.com这个接口

fckcg commented 1 year ago

我的提示这个,一直失败 这个api.openai.com 在国内是不能正常使用的,可以使用 https://aigc2d.com/ 这个平台来替换api.openai.com这个接口

那设置里要更改吗?没看到更改接口地址的地方

anhao commented 1 year ago

我的提示这个,一直失败 这个api.openai.com 在国内是不能正常使用的,可以使用 https://aigc2d.com/ 这个平台来替换api.openai.com这个接口

那设置里要更改吗?

需要改下代码

fckcg commented 1 year ago

请问一下更改哪个代码,没找到,谢谢

fckcg commented 1 year ago

我的提示这个,一直失败 这个api.openai.com 在国内是不能正常使用的,可以使用 https://aigc2d.com/ 这个平台来替换api.openai.com这个接口

那设置里要更改吗?

需要改下代码 一直没找到怎么更改这个接口,麻烦告知一下,谢谢

anhao commented 1 year ago

manager.py

        # 测试openai库
        llm = OpenAI(temperature=config.temperature, openai_api_key=get_openai_key(), verbose=config.debug,openai_api_base="https://api.aigc2d.com")

core/vup.py

        chat = ChatOpenAI(temperature=config.temperature, max_retries=2, max_tokens=150,
                          openai_api_key=get_openai_key(),openai_api_base="https://api.aigc2d.com")

如果不行就把 https://api.aigc2d.com 换成 https://api.aigc2d.com/v1

然后需要把 config.sample.ini 里的 api_key 换成 aigc2d平台的 apikey

fckcg commented 1 year ago

是在这两个代码里添加这行代码是吧。我试试,谢谢

anhao commented 1 year ago

还需要把 config.ini 里的 proxy 改为空

proxy = 
anhao commented 1 year ago

openai_api_base 的值改成 https://api.aigc2d.com/v1

fckcg commented 1 year ago

显示成功了,但是又有一个问题 读取embedding文件错误,请检查本地是否生成action.json 且动作不为空, 使用action plugin前请先运行 python manager.py action Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "manager.py", line 62, in test_plugin_dependency from pymilvus import connections, has_collection, Collection ModuleNotFoundError: No module named 'pymilvus'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manager.py", line 98, in fire.Fire(Management) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "manager.py", line 34, in run self.test_plugin_dependency() File "manager.py", line 65, in test_plugin_dependency raise 'Please run pip install pymilvus==2.0 cryptography parsel' TypeError: exceptions must derive from BaseException

fckcg commented 1 year ago

python manager.py action 读取embedding文件错误,请检查本地是否生成action.json 且动作不为空, 使用action plugin前请先运行 python manager.py action [Errno 2] No such file or directory: './action.json'

anhao commented 1 year ago

ModuleNotFoundError: No module named 'pymilvus'

应该是没有安装 pymilvus 这个包

fckcg commented 1 year ago

装了 后面提示 这个 读取embedding文件错误,请检查本地是否生成action.json 且动作不为空, 使用action plugin前请先运行 python manager.py action [Errno 2] No such file or directory: './action.json' Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\client\grpc_handler.py", line 90, in _wait_for_channel_ready grpc.channel_ready_future(self._channel).result(timeout=3) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\grpc_utilities.py", line 140, in result self._block(timeout) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\grpc_utilities.py", line 86, in _block raise grpc.FutureTimeoutError() grpc.FutureTimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manager.py", line 98, in fire.Fire(Management) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, kwargs) File "manager.py", line 34, in run self.test_plugin_dependency() File "manager.py", line 77, in test_plugin_dependency raise e File "manager.py", line 68, in test_plugin_dependency connections.connect( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\orm\connections.py", line 156, in connect conn = connect_milvus(kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\orm\connections.py", line 144, in connect_milvus gh._wait_for_channel_ready() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\client\grpc_handler.py", line 93, in _wait_for_channel_ready raise BaseException(Status.CONNECT_FAILED, f'Fail connecting to server on {self._uri}. Timeout') pymilvus.client.exceptions.BaseException: <BaseException: (code=2, message=Fail connecting to server on xxxxxx:19530. Timeout)>

anhao commented 1 year ago

那还有安装 milvus 数据库,看代码是需要这个数据库,配置文件里也有这个milvus host 配置

fckcg commented 1 year ago

都有安装 读取embedding文件错误,请检查本地是否生成action.json 且动作不为空, 使用action plugin前请先运行 python manager.py action [Errno 2] No such file or directory: './action.json' Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\client\grpc_handler.py", line 90, in _wait_for_channel_ready grpc.channel_ready_future(self._channel).result(timeout=3) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\grpc_utilities.py", line 140, in result self._block(timeout) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\grpc_utilities.py", line 86, in _block raise grpc.FutureTimeoutError() grpc.FutureTimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "manager.py", line 98, in fire.Fire(Management) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, kwargs) File "manager.py", line 34, in run self.test_plugin_dependency() File "manager.py", line 77, in test_plugin_dependency raise e File "manager.py", line 68, in test_plugin_dependency connections.connect( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\orm\connections.py", line 156, in connect conn = connect_milvus(kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\orm\connections.py", line 144, in connect_milvus gh._wait_for_channel_ready() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pymilvus\client\grpc_handler.py", line 93, in _wait_for_channel_ready raise BaseException(Status.CONNECT_FAILED, f'Fail connecting to server on {self._uri}. Timeout') pymilvus.client.exceptions.BaseException: <BaseException: (code=2, message=Fail connecting to server on xxxxxx:19530. Timeout)>

anhao commented 1 year ago

pymilvus.client.exceptions.BaseException: <BaseException: (code=2, message=Fail connecting to server on xxxxxx:19530. Timeout)>

都有安装 ,那就配置好 milvus 正确的主机地址

[milvus]
host = xxxxxx
port = 19530
collection = sun_ba
top_n = 4
fckcg commented 1 year ago

pymilvus.client.exceptions.BaseException: <BaseException: (code=2, message=Fail connecting to server on xxxxxx:19530. Timeout)>

都有安装 ,那就配置好 milvus 正确的主机地址

[milvus]
host = xxxxxx
port = 19530
collection = sun_ba
top_n = 4

好复杂,好难弄 麻烦问一下这个要怎么配置呢?完全不懂