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

openai 接口timeout #2

Open
youngfreeFJS opened this issue May 15, 2023 · 0 comments
Open

openai 接口timeout #2

youngfreeFJS opened this issue May 15, 2023 · 0 comments

Comments

@youngfreeFJS
Copy link
Owner

youngfreeFJS commented May 15, 2023

挂着代理(monoproxy),但是openai-python仍然是413
能够复现

  • 开着monoproxy,在postman请求是ok的
  • 开着monoproxy,在终端: 设置monoproxy的终端export + postman shell cmd 是ok的
  • 开着monoproxy,在终端: postman shell cmd 是fail的
  • 开着monoproxy,在python3,怎么都是失败的
import requests

s = requests.Session()
s.proxies = {"http": 'http://127.0.0.1:8118', "https": 'http://127.0.0.1:8118'}


r = s.request(method='post',
              url='https://api.openai.com/v1/engines/text-embedding-ada-002/embeddings',
              data=b'{"input": ["[]"], "encoding_format": "base64"}',
              timeout=3,
              proxies=s.proxies,
              headers= {'X-OpenAI-Client-User-Agent': '{"bindings_version": "0.27.6", "httplib": "requests", "lang": "python", "lang_version": "3.9.5", "platform": "macOS-10.15.7-x86_64-i386-64bit", "publisher": "openai", "uname": "Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 18 21:50:40 PDT 2022; root:xnu-6153.141.62~1/RELEASE_X86_64 x86_64"}',
                        'User-Agent': 'OpenAI/v1 PythonBindings/0.27.6',
                        'Authorization': 'Bearer sk-xxx',
                        'Content-Type': 'application/json'},
)
print(r.text())
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

1 participant