openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

Issue with updating the openai.proxy field

Open Comrade19632 opened this issue 2 years ago • 0 comments

Describe the bug

I'm experiencing an issue with updating the openai.proxy . When I make a request to OpenAI using this library, I set the openai.proxy field to a proxy value. However, if the request fails and I change the openai.proxy field to a different value, subsequent requests continue to use the old proxy value instead of the updated one.

To Reproduce

  1. Create an array of two elements, where the first element is an invalid proxy and the second element is a valid one.
  2. Run a loop over this array, updating the value of openai.proxy each time, and attempt to make requests to the OpenAI API.
  3. Requests will fail on all proxies, as the value of openai.proxy does not seem to change. Additionally, if a valid proxy is placed first, all requests will succeed, as if all proxies were valid.

Code snippets

No response

OS

ubuntu

Python version

python:3.8.3

Library version

openai==0.27.2

Comrade19632 avatar Mar 26 '23 16:03 Comrade19632