Update api_usage.py
Browse files- api_usage.py +7 -10
api_usage.py
CHANGED
|
@@ -200,11 +200,8 @@ def check_key_gemini_availability(key):
|
|
| 200 |
#print(e)
|
| 201 |
return 'Error while making request.', None
|
| 202 |
|
| 203 |
-
def check_key_azure_availability(
|
| 204 |
-
try:
|
| 205 |
-
endpoint = key.split(';')[0]
|
| 206 |
-
api_key = key.split(';')[1]
|
| 207 |
-
|
| 208 |
if endpoint.startswith('http'):
|
| 209 |
url = f'{endpoint}/openai/models?api-version=2023-03-15-preview'
|
| 210 |
else:
|
|
@@ -287,21 +284,21 @@ def get_azure_status(endpoint, api_key, deployments_list):
|
|
| 287 |
has_turbo = False
|
| 288 |
list_model = {}
|
| 289 |
for model, deploy in azure_deploy.items():
|
| 290 |
-
if model
|
| 291 |
list_model[model] = deploy
|
| 292 |
has_32k = True
|
| 293 |
-
elif model
|
| 294 |
list_model[model] = deploy
|
| 295 |
has_gpt4 = True
|
| 296 |
-
elif model
|
| 297 |
list_model[model] = deploy
|
| 298 |
has_turbo = True
|
| 299 |
|
| 300 |
if not list_model: #has_32k == False and has_gpt4 == False and has_turbo == False:
|
| 301 |
-
return "No GPT model to check.",
|
| 302 |
else:
|
| 303 |
if has_gpt4:
|
| 304 |
-
has_gpt4turbo = check_gpt4turbo(
|
| 305 |
|
| 306 |
pozz_res = {}
|
| 307 |
|
|
|
|
| 200 |
#print(e)
|
| 201 |
return 'Error while making request.', None
|
| 202 |
|
| 203 |
+
def check_key_azure_availability(endpoint, api_key):
|
| 204 |
+
try:
|
|
|
|
|
|
|
|
|
|
| 205 |
if endpoint.startswith('http'):
|
| 206 |
url = f'{endpoint}/openai/models?api-version=2023-03-15-preview'
|
| 207 |
else:
|
|
|
|
| 284 |
has_turbo = False
|
| 285 |
list_model = {}
|
| 286 |
for model, deploy in azure_deploy.items():
|
| 287 |
+
if model.startswith('gpt-4-32k'):
|
| 288 |
list_model[model] = deploy
|
| 289 |
has_32k = True
|
| 290 |
+
elif model.startswith('gpt-4'):
|
| 291 |
list_model[model] = deploy
|
| 292 |
has_gpt4 = True
|
| 293 |
+
elif model.startswith('gpt-35-turbo'):
|
| 294 |
list_model[model] = deploy
|
| 295 |
has_turbo = True
|
| 296 |
|
| 297 |
if not list_model: #has_32k == False and has_gpt4 == False and has_turbo == False:
|
| 298 |
+
return "No GPT model to check.", has_32k, has_gpt4turbo, has_gpt4, has_turbo
|
| 299 |
else:
|
| 300 |
if has_gpt4:
|
| 301 |
+
has_gpt4turbo = check_gpt4turbo(endpoint, api_key, list_model['gpt-4'])
|
| 302 |
|
| 303 |
pozz_res = {}
|
| 304 |
|