diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 32f0d3ae1..cd5523851 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -8883,7 +8883,10 @@ async def new_user(data: NewUserRequest): role="user", user_email=data_json.get("user_email", None), ), - ) + ), + http_request=Request( + scope={"type": "http"}, + ), ) if data.send_invite_email is True: @@ -9919,6 +9922,7 @@ async def delete_end_user( @management_endpoint_wrapper async def new_team( data: NewTeamRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), litellm_changed_by: Optional[str] = Header( None, @@ -10261,6 +10265,7 @@ async def update_team( @management_endpoint_wrapper async def team_member_add( data: TeamMemberAddRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): """ @@ -10355,6 +10360,7 @@ async def team_member_add( @management_endpoint_wrapper async def team_member_delete( data: TeamMemberDeleteRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): """ @@ -10461,6 +10467,7 @@ async def team_member_delete( @management_endpoint_wrapper async def delete_team( data: DeleteTeamRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), litellm_changed_by: Optional[str] = Header( None, @@ -10546,6 +10553,7 @@ async def delete_team( ) @management_endpoint_wrapper async def team_info( + http_request: Request, team_id: str = fastapi.Query( default=None, description="Team ID in the request parameters" ), @@ -10635,6 +10643,7 @@ async def team_info( @management_endpoint_wrapper async def block_team( data: BlockTeamRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): """ @@ -10658,6 +10667,7 @@ async def block_team( @management_endpoint_wrapper async def unblock_team( data: BlockTeamRequest, + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): """ @@ -10680,6 +10690,7 @@ async def unblock_team( ) @management_endpoint_wrapper async def list_team( + http_request: Request, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): """ diff --git a/litellm/tests/test_key_generate_prisma.py b/litellm/tests/test_key_generate_prisma.py index 277d9718f..aaef9d6ca 100644 --- a/litellm/tests/test_key_generate_prisma.py +++ b/litellm/tests/test_key_generate_prisma.py @@ -137,6 +137,7 @@ async def test_new_user_response(prisma_client): NewTeamRequest( team_id=_team_id, ), + http_request=Request(scope={"type": "http"}), user_api_key_dict=UserAPIKeyAuth( user_role=LitellmUserRoles.PROXY_ADMIN, api_key="sk-1234", @@ -368,6 +369,7 @@ async def test_call_with_valid_model_using_all_models(prisma_client): new_team_response = await new_team( data=team_request, user_api_key_dict=UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN), + http_request=Request(scope={"type": "http"}), ) print("new_team_response", new_team_response) created_team_id = new_team_response["team_id"] @@ -1086,6 +1088,7 @@ def test_generate_and_update_key(prisma_client): api_key="sk-1234", user_id="1234", ), + http_request=Request(scope={"type": "http"}), ) _team_2 = "ishaan-special-team_{}".format(uuid.uuid4()) @@ -1098,6 +1101,7 @@ def test_generate_and_update_key(prisma_client): api_key="sk-1234", user_id="1234", ), + http_request=Request(scope={"type": "http"}), ) request = NewUserRequest( @@ -2050,6 +2054,7 @@ async def test_master_key_hashing(prisma_client): api_key="sk-1234", user_id="1234", ), + http_request=Request(scope={"type": "http"}), ) _response = await new_user( @@ -2183,6 +2188,7 @@ async def test_create_update_team(prisma_client): tpm_limit=20, rpm_limit=20, ), + http_request=Request(scope={"type": "http"}), user_api_key_dict=UserAPIKeyAuth( user_role=LitellmUserRoles.PROXY_ADMIN, api_key="sk-1234", @@ -2232,7 +2238,10 @@ async def test_create_update_team(prisma_client): ) # now hit team_info - response = await team_info(team_id=_team_id) + response = await team_info( + team_id=_team_id, + http_request=Request(scope={"type": "http"}), + ) print("RESPONSE from team_info", response)