fix(proxy/_types.py): fix validation check

This commit is contained in:
Krrish Dholakia 2024-06-08 22:56:56 -07:00
parent def648ed3f
commit d066e0e152
3 changed files with 4 additions and 5 deletions

View file

@ -719,6 +719,8 @@ class Member(LiteLLMBase):
@model_validator(mode="before") @model_validator(mode="before")
@classmethod @classmethod
def check_user_info(cls, values): def check_user_info(cls, values):
if not isinstance(values, dict):
raise ValueError("input needs to be a dictionary")
if values.get("user_id") is None and values.get("user_email") is None: if values.get("user_id") is None and values.get("user_email") is None:
raise ValueError("Either user id or user email must be provided") raise ValueError("Either user id or user email must be provided")
return values return values

View file

@ -10189,10 +10189,8 @@ async def team_member_add(
complete_team_data.members_with_roles.extend(new_members) complete_team_data.members_with_roles.extend(new_members)
# ADD MEMBER TO TEAM # ADD MEMBER TO TEAM
_db_team_members = [ _db_team_members = [m.model_dump() for m in complete_team_data.members_with_roles]
m.model_dump() for m in complete_team_data.members_with_roles
]
updated_team = await prisma_client.db.litellm_teamtable.update( updated_team = await prisma_client.db.litellm_teamtable.update(
where={"team_id": data.team_id}, where={"team_id": data.team_id},
data={"members_with_roles": json.dumps(_db_team_members)}, # type: ignore data={"members_with_roles": json.dumps(_db_team_members)}, # type: ignore

View file

@ -1175,7 +1175,6 @@ def test_generate_and_update_key(prisma_client):
asyncio.run(test()) asyncio.run(test())
except Exception as e: except Exception as e:
print("Got Exception", e) print("Got Exception", e)
print(e.message)
pytest.fail(f"An exception occurred - {str(e)}") pytest.fail(f"An exception occurred - {str(e)}")