forked from phoenix/litellm-mirror
fix(proxy_server.py): fix /v1/models
bug where it would return empty list
handle 'all-team-models' being set for a given key
This commit is contained in:
parent
8e5437c8e9
commit
f2766fddbf
2 changed files with 61 additions and 1 deletions
|
@ -227,6 +227,10 @@ class UserAPIKeyCacheTTLEnum(enum.Enum):
|
|||
global_proxy_spend = 60
|
||||
|
||||
|
||||
class SpecialModelNames(enum.Enum):
|
||||
all_team_models = "all-team-models"
|
||||
|
||||
|
||||
@app.exception_handler(ProxyException)
|
||||
async def openai_exception_handler(request: Request, exc: ProxyException):
|
||||
# NOTE: DO NOT MODIFY THIS, its crucial to map to Openai exceptions
|
||||
|
@ -3436,7 +3440,9 @@ def model_list(
|
|||
all_models = []
|
||||
if len(user_api_key_dict.models) > 0:
|
||||
all_models = user_api_key_dict.models
|
||||
else:
|
||||
if SpecialModelNames.all_team_models.value in all_models:
|
||||
all_models = user_api_key_dict.team_models
|
||||
if len(all_models) == 0: # has all proxy models
|
||||
## if no specific model access
|
||||
if general_settings.get("infer_model_from_keys", False):
|
||||
all_models = litellm.utils.get_valid_models()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue