cxumol commited on
Commit
5c66db7
1 Parent(s): 6013462

debug: improve logging at app.util.is_valid_openai_api_key()

Browse files
Files changed (1) hide show
  1. app/util.py +3 -3
app/util.py CHANGED
@@ -40,9 +40,9 @@ def is_valid_openai_api_key(api_base: str, api_key: str) -> bool:
40
  headers = {"Authorization": f"Bearer {api_key}"}
41
  test_url = f"{api_base}/models"
42
  response = requests.get(test_url, headers=headers)
43
- if response.status_code != 200:
44
- ic(response.json())
45
- return response.status_code == 200
46
 
47
 
48
  def checkAPI(api_base: str, api_key: str):
 
40
  headers = {"Authorization": f"Bearer {api_key}"}
41
  test_url = f"{api_base}/models"
42
  response = requests.get(test_url, headers=headers)
43
+ if response.status_code in range(200,300):
44
+ ic(response.text())
45
+ return response.status_code in range(200,300)
46
 
47
 
48
  def checkAPI(api_base: str, api_key: str):