APIConnectionError raised when using AsyncOpenAI along FastAPI and uvicorn(uvloop) #1927
Open
1 task done
Labels
bug
Something isn't working
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Exception raised when using AsyncOpenAI with FastAPI and uvicorn issue seems to be compability issues with
uvloop
that is added through the extras = ["standard"].Installing dependencies manually and leaving out uvloop works.
To Reproduce
pyproject.toml with poetry dep.
[tool.poetry.dependencies]
python = ">=3.11,<3.12"
fastapi = "0.115.6"
uvicorn = {extras = ["standard"], version = "0.32.1"}
openai = "^1.54.4"
Run app main.py.
Call endpoint
http://localhost:50051/test
Exception:
File "/Users/badrelfarri/Documents/Code/RevVue/simple-async-openai-assistant/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1610, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
Code snippets
OS
macOS
Python version
Python 3.11.4
Library version
openai v1.54.4
The text was updated successfully, but these errors were encountered: