BUG: AsyncClient.__init__() got an unexpected keyword argument 'proxies'

#532 · closed · 1 comments

View on GitHub ↗

elersong

When attempting to start the docker container, I'm getting the following logger output and constantly restarting container. ``` 2024-12-23T21:47:19.546127667Z Traceback (most recent call last): 2024-12-23T21:47:19.546161829Z File "/DiscordBot/main.py", line 3, in <module> 2024-12-23T21:47:19.546166321Z from src import bot 2024-12-23T21:47:19.546168773Z File "/DiscordBot/src/bot.py", line 11, in <module> 2024-12-23T21:47:19.546171717Z from src.aclient import discordClient 2024-12-23T21:47:19.546223901Z File "/DiscordBot/src/aclient.py", line 131, in <module> 2024-12-23T21:47:19.546227195Z discordClient = discordClient() 2024-12-23T21:47:19.546229432Z File "/DiscordBot/src/aclient.py", line 41, in __init__ 2024-12-23T21:47:19.546231847Z self.openai_client = AsyncOpenAI(api_key=os.getenv("OPENAI_KEY")) 2024-12-23T21:47:19.546234135Z File "/usr/local/lib/python3.10/site-packages/openai/_client.py", line 334, in __init__ 2024-12-23T21:47:19.546236437Z super().__init__( 2024-12-23T21:47:19.546238579Z File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1400, in __init__ 2024-12-23T21:47:19.546240832Z self._client = http_client or AsyncHttpxClientWrapper( 2024-12-23T21:47:19.546243022Z File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1297, in __init__ 2024-12-23T21:47:19.546245238Z super().__init__(**kwargs) 2024-12-23T21:47:19.546247348Z TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies' ``` A cursory bug investigation led me to [this](https://community.openai.com/t/typeerror-asyncclient-init-got-an-unexpected-keyword-argument-proxies/1040287) from the openai forums: > The proxies argument issue occurs because it was deprecated in recent versions of OpenAI. Since an upgrade is not possible, revert to a proxy-compatible earlier version of the OpenAI library or remove proxies and set them via environment variables instead. Older versions are not expected to have a fix.

Comments

elersong

It looks like updating to the latest `openai` library version in `requirements.txt` and running `docker compose up --build` gets everything back up and running.