AutoGPT: Connection to api.openai.com timed out

⚠️ Search for existing issues first ⚠️

  • I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Docker

Which version of Auto-GPT are you using?

Latest Release

GPT-3 or GPT-4?

GPT-4

Steps to reproduce 🕹

Current behavior 😯

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/urllib3/connection.py”, line 174, in _new_conn conn = connection.create_connection( File “/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py”, line 95, in create_connection raise err File “/usr/local/lib/python3.10/site-packages/urllib3/util/connection.py”, line 85, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 703, in urlopen httplib_response = self._make_request( File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 386, in _make_request self._validate_conn(conn) File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 1042, in _validate_conn conn.connect() File “/usr/local/lib/python3.10/site-packages/urllib3/connection.py”, line 363, in connect self.sock = conn = self._new_conn() File “/usr/local/lib/python3.10/site-packages/urllib3/connection.py”, line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f3f8bbde830>, ‘Connection to api.openai.com timed out. (connect timeout=600)’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/requests/adapters.py”, line 487, in send resp = conn.urlopen( File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 815, in urlopen return self.urlopen( File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 815, in urlopen return self.urlopen( File “/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py”, line 787, in urlopen retries = retries.increment( File “/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py”, line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3f8bbde830>, ‘Connection to api.openai.com timed out. (connect timeout=600)’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/openai/api_requestor.py”, line 516, in request_raw result = _thread_context.session.request( File “/usr/local/lib/python3.10/site-packages/requests/sessions.py”, line 587, in request resp = self.send(prep, **send_kwargs) File “/usr/local/lib/python3.10/site-packages/requests/sessions.py”, line 701, in send r = adapter.send(request, **kwargs) File “/usr/local/lib/python3.10/site-packages/requests/adapters.py”, line 508, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3f8bbde830>, ‘Connection to api.openai.com timed out. (connect timeout=600)’))

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File “/usr/local/lib/python3.10/runpy.py”, line 196, in _run_module_as_main return _run_code(code, main_globals, None, File “/usr/local/lib/python3.10/runpy.py”, line 86, in _run_code exec(code, run_globals) File “/app/autogpt/main.py”, line 5, in <module> autogpt.cli.main() File “/usr/local/lib/python3.10/site-packages/click/core.py”, line 1130, in call return self.main(*args, **kwargs) File “/usr/local/lib/python3.10/site-packages/click/core.py”, line 1055, in main rv = self.invoke(ctx) File “/usr/local/lib/python3.10/site-packages/click/core.py”, line 1635, in invoke rv = super().invoke(ctx) File “/usr/local/lib/python3.10/site-packages/click/core.py”, line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File “/usr/local/lib/python3.10/site-packages/click/core.py”, line 760, in invoke return __callback(*args, **kwargs) File “/usr/local/lib/python3.10/site-packages/click/decorators.py”, line 26, in new_func return f(get_current_context(), *args, **kwargs) File “/app/autogpt/cli.py”, line 90, in main run_auto_gpt( File “/app/autogpt/main.py”, line 171, in run_auto_gpt agent.start_interaction_loop() File “/app/autogpt/agent/agent.py”, line 112, in start_interaction_loop assistant_reply = chat_with_ai( File “/app/autogpt/llm/chat.py”, line 245, in chat_with_ai assistant_reply = create_chat_completion( File “/app/autogpt/llm/llm_utils.py”, line 166, in create_chat_completion response = api_manager.create_chat_completion( File “/app/autogpt/llm/api_manager.py”, line 55, in create_chat_completion response = openai.ChatCompletion.create( File “/usr/local/lib/python3.10/site-packages/openai/api_resources/chat_completion.py”, line 25, in create return super().create(*args, **kwargs) File “/usr/local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py”, line 153, in create response, _, api_key = requestor.request( File “/usr/local/lib/python3.10/site-packages/openai/api_requestor.py”, line 216, in request result = self.request_raw( File “/usr/local/lib/python3.10/site-packages/openai/api_requestor.py”, line 526, in request_raw raise error.Timeout(“Request timed out: {}”.format(e)) from e openai.error.Timeout: Request timed out: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f3f8bbde830>, ‘Connection to api.openai.com timed out. (connect timeout=600)’))

Expected behavior 🤔

No response

Your prompt 📝

# Paste your prompt here

Your Logs 📒

<insert your logs here>

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (2 by maintainers)

Most upvoted comments

Interesting…

Can you use ```s? Markdown is trying to parse your #'s

Hey I just noticed something. Your url is wrong. v1/{ai model here__}/chat/completions. It’s missing the ai model

It says “max retries with v1/chat/completions”

Current list of unsupported regions (may be inaccurate, please check with your API provider and your local ordinance)

A. Afghanistan B. Bahrain, Belarus, Burma (Myanmar) C. Central African Republic, Chad, China, Cuba E. Eritrea, Ethiopia I. Iran K. Kazahkstan, North Korea L. Laos, Libya M. Macedonia, Marshall Islands, Mauritius, Micronesia, Burma (Myanmar) N. Nauru, Nepal, North Korea P. Palau R. Russia S. Saint Kitts and Nevis, Saint Lucia, Saint Vincent and Grenadines, Somalia, South Sudan, Sudan, Syria T. Tonga, Turkmenistan U. Ukraine, Uzbekistan V. Venezuela Y. Yemen

How can we retry without having to go through 5 steps of outlining the goals for the AI again every attempt? There’s no obvious cause for this error and it’s very difficult to debug when you need to re-enter all this text in 5 separate prompts for every attempt.

It seems like an ai_settings.yaml file would help but there’s seemingly no template on the web? (related https://github.com/Significant-Gravitas/Auto-GPT/issues/1106)