Merge pull request #1933 from BerriAI/litellm_team_specific_models

[FEAT] Proxy - set team specific models
This commit is contained in:
Ishaan Jaff 2024-02-10 21:40:13 -08:00 committed by GitHub
commit 1cb8d2d3a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 16 deletions

View file

@ -1303,6 +1303,20 @@ async def _read_request_body(request):
return request_data
def _is_valid_team_configs(team_id=None, team_config=None, request_data=None):
if team_id is None or team_config is None or request_data is None:
return
# check if valid model called for team
if "models" in team_config:
valid_models = team_config.pop("models")
model_in_request = request_data["model"]
if model_in_request not in valid_models:
raise Exception(
f"Invalid model for team {team_id}: {model_in_request}. Valid models for team are: {valid_models}\n"
)
return
# LiteLLM Admin UI - Non SSO Login
html_form = """
<!DOCTYPE html>