arata
December 2, 2024, 10:30pm
2
It is your environment: ill-advised Python 3.13, and deprecated method in the httpx library installed. It is no help that there is no requirements.txt in the python sdk repo, but a requirements.lock file has all pinned versions including the httpx past the deprecation employed.
opened 08:57AM - 29 Nov 24 UTC
closed 06:53AM - 04 Dec 24 UTC
**Bug description**
There is an issue with the openai-python library related to… the httpx library. Specifically, httpx version 0.28.0 has removed the deprecated `proxies` argument, which is still hardcoded in the openai-python library. This results in a `TypeError` when initializing the client. This issue likely affects all OpenAI models, including GPT-4o and GPT-4o-mini.
**Bug solved method**
A temporary solution is to pin the httpx version to 0.27.2. By adding `httpx==0.27.2` to the project's dependency file, the issue can be avoided. I have verified this solution locally by executing `pip install httpx==0.27.2`.
**Environment information**
- LLM type and model name: OpenAI GPT-4o, GPT-4o-mini
- System version: Windows 11, Ubuntu 22.04, Docker version of MetaGPT
- Python version: Python 3.9
- MetaGPT version or branch: latest
- packages version: openai-1.55.2, httpx-0.28.0
- installation method: pip install
**Screenshots or logs**
```
Traceback (most recent call last):
File "/var/lang/lib/python3.10/site-packages/openai/_client.py", line 337, in __init__
super().__init__(
File "/var/lang/lib/python3.10/site-packages/openai/_base_client.py", line 1438, in __init__
self._client = http_client or AsyncHttpxClientWrapper(
File "/var/lang/lib/python3.10/site-packages/openai/_base_client.py", line 1335, in __init__
super().__init__(**kwargs)
TypeError: AsyncClient.__init__() got an unexpected keyword argument 'proxies'
```
Original issue link: [Use of proxies kwarg in httpx==0.28.0 #1902](https://github.com/openai/openai-python/issues/1902)
The cli/_tools/fine_tunes.py hasn’t been touched for over a year. It will reject more valid training file than it would validate at this point.
(edit: the latest OpenAI Python client resolves this issue)