forked from phoenix/litellm-mirror
fix team endpoints
This commit is contained in:
parent
7ad981b85c
commit
fba7d2e623
2 changed files with 22 additions and 2 deletions
|
@ -8883,7 +8883,10 @@ async def new_user(data: NewUserRequest):
|
||||||
role="user",
|
role="user",
|
||||||
user_email=data_json.get("user_email", None),
|
user_email=data_json.get("user_email", None),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
http_request=Request(
|
||||||
|
scope={"type": "http"},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if data.send_invite_email is True:
|
if data.send_invite_email is True:
|
||||||
|
@ -9919,6 +9922,7 @@ async def delete_end_user(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def new_team(
|
async def new_team(
|
||||||
data: NewTeamRequest,
|
data: NewTeamRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
litellm_changed_by: Optional[str] = Header(
|
litellm_changed_by: Optional[str] = Header(
|
||||||
None,
|
None,
|
||||||
|
@ -10261,6 +10265,7 @@ async def update_team(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def team_member_add(
|
async def team_member_add(
|
||||||
data: TeamMemberAddRequest,
|
data: TeamMemberAddRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -10355,6 +10360,7 @@ async def team_member_add(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def team_member_delete(
|
async def team_member_delete(
|
||||||
data: TeamMemberDeleteRequest,
|
data: TeamMemberDeleteRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -10461,6 +10467,7 @@ async def team_member_delete(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def delete_team(
|
async def delete_team(
|
||||||
data: DeleteTeamRequest,
|
data: DeleteTeamRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
litellm_changed_by: Optional[str] = Header(
|
litellm_changed_by: Optional[str] = Header(
|
||||||
None,
|
None,
|
||||||
|
@ -10546,6 +10553,7 @@ async def delete_team(
|
||||||
)
|
)
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def team_info(
|
async def team_info(
|
||||||
|
http_request: Request,
|
||||||
team_id: str = fastapi.Query(
|
team_id: str = fastapi.Query(
|
||||||
default=None, description="Team ID in the request parameters"
|
default=None, description="Team ID in the request parameters"
|
||||||
),
|
),
|
||||||
|
@ -10635,6 +10643,7 @@ async def team_info(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def block_team(
|
async def block_team(
|
||||||
data: BlockTeamRequest,
|
data: BlockTeamRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -10658,6 +10667,7 @@ async def block_team(
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def unblock_team(
|
async def unblock_team(
|
||||||
data: BlockTeamRequest,
|
data: BlockTeamRequest,
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -10680,6 +10690,7 @@ async def unblock_team(
|
||||||
)
|
)
|
||||||
@management_endpoint_wrapper
|
@management_endpoint_wrapper
|
||||||
async def list_team(
|
async def list_team(
|
||||||
|
http_request: Request,
|
||||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -137,6 +137,7 @@ async def test_new_user_response(prisma_client):
|
||||||
NewTeamRequest(
|
NewTeamRequest(
|
||||||
team_id=_team_id,
|
team_id=_team_id,
|
||||||
),
|
),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
user_api_key_dict=UserAPIKeyAuth(
|
user_api_key_dict=UserAPIKeyAuth(
|
||||||
user_role=LitellmUserRoles.PROXY_ADMIN,
|
user_role=LitellmUserRoles.PROXY_ADMIN,
|
||||||
api_key="sk-1234",
|
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(
|
new_team_response = await new_team(
|
||||||
data=team_request,
|
data=team_request,
|
||||||
user_api_key_dict=UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN),
|
user_api_key_dict=UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
)
|
)
|
||||||
print("new_team_response", new_team_response)
|
print("new_team_response", new_team_response)
|
||||||
created_team_id = new_team_response["team_id"]
|
created_team_id = new_team_response["team_id"]
|
||||||
|
@ -1086,6 +1088,7 @@ def test_generate_and_update_key(prisma_client):
|
||||||
api_key="sk-1234",
|
api_key="sk-1234",
|
||||||
user_id="1234",
|
user_id="1234",
|
||||||
),
|
),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
)
|
)
|
||||||
|
|
||||||
_team_2 = "ishaan-special-team_{}".format(uuid.uuid4())
|
_team_2 = "ishaan-special-team_{}".format(uuid.uuid4())
|
||||||
|
@ -1098,6 +1101,7 @@ def test_generate_and_update_key(prisma_client):
|
||||||
api_key="sk-1234",
|
api_key="sk-1234",
|
||||||
user_id="1234",
|
user_id="1234",
|
||||||
),
|
),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
)
|
)
|
||||||
|
|
||||||
request = NewUserRequest(
|
request = NewUserRequest(
|
||||||
|
@ -2050,6 +2054,7 @@ async def test_master_key_hashing(prisma_client):
|
||||||
api_key="sk-1234",
|
api_key="sk-1234",
|
||||||
user_id="1234",
|
user_id="1234",
|
||||||
),
|
),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
)
|
)
|
||||||
|
|
||||||
_response = await new_user(
|
_response = await new_user(
|
||||||
|
@ -2183,6 +2188,7 @@ async def test_create_update_team(prisma_client):
|
||||||
tpm_limit=20,
|
tpm_limit=20,
|
||||||
rpm_limit=20,
|
rpm_limit=20,
|
||||||
),
|
),
|
||||||
|
http_request=Request(scope={"type": "http"}),
|
||||||
user_api_key_dict=UserAPIKeyAuth(
|
user_api_key_dict=UserAPIKeyAuth(
|
||||||
user_role=LitellmUserRoles.PROXY_ADMIN,
|
user_role=LitellmUserRoles.PROXY_ADMIN,
|
||||||
api_key="sk-1234",
|
api_key="sk-1234",
|
||||||
|
@ -2232,7 +2238,10 @@ async def test_create_update_team(prisma_client):
|
||||||
)
|
)
|
||||||
|
|
||||||
# now hit team_info
|
# 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)
|
print("RESPONSE from team_info", response)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue