Skip to content

OpenAI APIConnectionError #12

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

Open
hnipps opened this issue Apr 16, 2025 · 0 comments
Open

OpenAI APIConnectionError #12

hnipps opened this issue Apr 16, 2025 · 0 comments

Comments

@hnipps
Copy link

hnipps commented Apr 16, 2025

I'm trying to run the sample command from the readme and getting an APIConnectionError.

I have entered my API key in .env and verified that the API key is valid.

I've tried installing via pip and by pulling down the repo. I get the same error in both cases.

I'm on MacOS 14.5, using Python 3.12.7

Stack trace:

agents-deep-research on  main via 🐍 3.12.7 via agents-deep-research took 3.0s 
➜ python -m deep_researcher.main --mode deep --query "Provide a comprehensive overview of quantum computing" --max-iterations 3 --max-time 10 --verbose
Starting deep research on: Provide a comprehensive overview of quantum computing
Max iterations: 3, Max time: 10 minutes
=== Building Report Plan ===
Error getting response: Connection error.. (request_id: None)
Traceback (most recent call last):
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
    raise exc from None
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
    raise exc
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 124, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
    with map_exceptions(exc_map):
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/.pyenv/versions/3.12.7/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: All connection attempts failed

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

Traceback (most recent call last):
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1538, in _request
    response = await self._client.send(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1629, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1657, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1730, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 393, in handle_async_request
    with map_httpcore_exceptions():
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/.pyenv/versions/3.12.7/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

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

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/main.py", line 67, in <module>
    cli_entry()
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/main.py", line 64, in cli_entry
    asyncio.run(main())
  File "/Users/harry.nicholls/.pyenv/versions/3.12.7/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/.pyenv/versions/3.12.7/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/.pyenv/versions/3.12.7/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/main.py", line 44, in main
    report = await manager.run(query)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/deep_research.py", line 45, in run
    report_plan: ReportPlan = await self._build_report_plan(query)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/deep_research.py", line 69, in _build_report_plan
    result = await ResearchRunner.run(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/deep_researcher/agents/baseclass.py", line 58, in run
    result = await Runner.run(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/agents/run.py", line 215, in run
    input_guardrail_results, turn_result = await asyncio.gather(
                                           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/agents/run.py", line 739, in _run_single_turn
    new_response = await cls._get_new_response(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/agents/run.py", line 896, in _get_new_response
    new_response = await model.get_response(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/agents/models/openai_responses.py", line 75, in get_response
    response = await self._fetch_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/agents/models/openai_responses.py", line 234, in _fetch_response
    return await self._client.responses.create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/resources/responses/responses.py", line 1417, in create
    return await self._post(
           ^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1805, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1495, in request
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1562, in _request
    return await self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1632, in _retry_request
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1562, in _request
    return await self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1632, in _retry_request
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/harry.nicholls/repos/agents-deep-research/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1572, in _request
    raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
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