Rafal commited on
Commit
0711ef5
1 Parent(s): 46e1c9f

pin to old openai api version

Browse files
Files changed (3) hide show
  1. mgr_requests.py +1 -1
  2. openAI_manager.py +3 -3
  3. requirements.txt +1 -1
mgr_requests.py CHANGED
@@ -59,7 +59,7 @@ def _generateOnline(bias_spec, progress, key, num2gen, isSaving=False):
59
  models = oai_mgr.initOpenAI(key)
60
  model_names = [m['id'] for m in models['data']]
61
  print(f"Model names: {model_names}")
62
- except openai.AuthenticationError as err:
63
  #raise gr.Error(OPENAI_INIT_ERROR.replace("<ERR>", str(err)))
64
  gen_err_msg = OPENAI_INIT_ERROR.replace("<ERR>", str(err))
65
 
 
59
  models = oai_mgr.initOpenAI(key)
60
  model_names = [m['id'] for m in models['data']]
61
  print(f"Model names: {model_names}")
62
+ except openai.error.AuthenticationError as err:
63
  #raise gr.Error(OPENAI_INIT_ERROR.replace("<ERR>", str(err)))
64
  gen_err_msg = OPENAI_INIT_ERROR.replace("<ERR>", str(err))
65
 
openAI_manager.py CHANGED
@@ -48,9 +48,9 @@ Other attribute terms in this context are: {att_terms_str}. Use them for interpr
48
  #print(f"Instruction: {instruction}")
49
 
50
  # https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb
51
- @backoff.on_exception(backoff.expo, (openai.RateLimitError,
52
- openai.APIError,
53
- openai.ServiceUnavailableError,
54
  ConnectionResetError,
55
  json.decoder.JSONDecodeError))#,
56
  #max_time=300,
 
48
  #print(f"Instruction: {instruction}")
49
 
50
  # https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb
51
+ @backoff.on_exception(backoff.expo, (openai.error.RateLimitError,
52
+ openai.error.APIError,
53
+ openai.error.ServiceUnavailableError,
54
  ConnectionResetError,
55
  json.decoder.JSONDecodeError))#,
56
  #max_time=300,
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  torch
2
  transformers
3
- openai
4
  openpyxl
5
  backoff
6
  pandas
 
1
  torch
2
  transformers
3
+ openai=0.28
4
  openpyxl
5
  backoff
6
  pandas