From 4d9584ecd5f87c5d069a0d7ea1bebcd7dbc4c0f1 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 26 Feb 2024 19:57:13 -0800 Subject: [PATCH] test(proxy_server.py): check if token has team params --- litellm/proxy/proxy_server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index e3cd257fdc..7f88396340 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -614,6 +614,7 @@ async def user_api_key_auth( # Check 6. Token spend is under Team budget if ( valid_token.spend is not None + and hasattr(valid_token, "team_max_budget") and valid_token.team_max_budget is not None ): asyncio.create_task( @@ -632,7 +633,9 @@ async def user_api_key_auth( # Check 7. Team spend is under Team budget if ( - valid_token.team_spend is not None + hasattr(valid_token, "team_spend") + and valid_token.team_spend is not None + and hasattr(valid_token, "team_max_budget") and valid_token.team_max_budget is not None ): asyncio.create_task(