Skip to content
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

Action failing: Client.__init__() got an unexpected keyword argument 'proxies' #9

Closed
MatteoEgmont opened this issue Nov 28, 2024 · 5 comments · Fixed by #11
Closed

Comments

@MatteoEgmont
Copy link

Hi!

We are starting receiving this kind of error since ca. half an hour ago

Traceback (most recent call last):
  File "/action/autofill_description.py", line 239, in <module>
    sys.exit(main())
             ^^^^^^
  File "/action/autofill_description.py", line 189, in main
    else openai.OpenAI(api_key=openai_api_key)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.[11](https://github.com/ecomegmont/egmont_data_platform/actions/runs/12071818358/job/33664412474?pr=2450#step:3:12)/site-packages/openai/_client.py", line 122, in __init__
    super().__init__(
  File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 825, in __init__
    self._client = http_client or SyncHttpxClientWrapper(
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 723, in __init__
    super().__init__(**kwargs)
TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

It might be related to the latest bump in httpx to 0.28.0, encode/httpx#3419, which is the only noticeable difference between previous successful runs and the ones failing.

@devsetgo
Copy link

@MatteoEgmont I am getting the same issue, looks like it is a issue with HTTPX per the OpenAI issue here. The pyproject.toml from the repo shows that HTTPX floats (httpx>=0.23.0, <1) with httpx 0.28.0 being released 12 hours ago. The error is due to a deprecation of the "proxies" argument and will require this action to be updated for a new version of OpenAI library.

Here is the change log from HTTPX release.

0.28.0 (28th November, 2024)
The 0.28 release includes a limited set of deprecations.

Deprecations:

We are working towards a simplified SSL configuration API.

For users of the standard verify=True or verify=False cases, or verify=<ssl_context> case this should require no changes. The following cases have been deprecated...

The verify argument as a string argument is now deprecated and will raise warnings.
The cert argument is now deprecated and will raise warnings.
Our revised SSL documentation covers how to implement the same behaviour with a more constrained API.

The following changes are also included:

The deprecated proxies argument has now been removed.
The deprecated app argument has now been removed.
JSON request bodies use a compact representation. (#3363)
Review URL percent escape sets, based on WHATWG spec. (#3371, #3373)
Ensure certifi and httpcore are only imported if required. (#3377)
Treat socks5h as a valid proxy scheme. (#3178)
Cleanup Request() method signature in line with client.request() and httpx.request(). (#3378)

@VrushabhShirpurkar
Copy link

first terminate your kernal
then install !pip install httpx==0.23.0 stable version then install openai ,
then your code will work , it worked for me

@platisd
Copy link
Owner

platisd commented Nov 29, 2024

I believe this will be fixed if we start using a later version of openai (i.e. update this action's requirements.txt) which will in turn bring in newer dependencies, including the httpx one.
I am travelling these days so I will have time to look at this hopefully tonight, but in the meanwhile feel free to open a PR if you find a fix.

platisd added a commit that referenced this issue Nov 29, 2024
Using the latest openai module brings in updated dependencies that address #9
platisd added a commit that referenced this issue Nov 29, 2024
Using the latest openai module brings in updated dependencies that address #9.
@platisd platisd linked a pull request Nov 29, 2024 that will close this issue
platisd added a commit that referenced this issue Nov 29, 2024
Using the latest openai module brings in updated dependencies that address #9.
@aditiphadnis
Copy link

!pip install httpx==0.23.0 worked for me. Thanks.

@platisd
Copy link
Owner

platisd commented Dec 6, 2024

@aditiphadnis did you try using the latest version of the Action?

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

Successfully merging a pull request may close this issue.

5 participants