Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(utils.py): only return non-null default values

Krrish Dholakia9f0a05d406bb
diff --git a/litellm/proxy/management_helpers/utils.py b/litellm/proxy/management_helpers/utils.py
index a897dfd5f01..1fa7a6f1761 100644
--- a/litellm/proxy/management_helpers/utils.py
+++ b/litellm/proxy/management_helpers/utils.py
@@ -30,7 +30,7 @@ from litellm.proxy.utils import PrismaClient
def get_new_internal_user_defaults(
user_id: str, user_email: Optional[str] = None
-) -> SSOUserDefinedValues:
+) -> dict:
user_info = litellm.default_user_params or {}
returned_dict: SSOUserDefinedValues = {
@@ -44,7 +44,11 @@ def get_new_internal_user_defaults(
"user_role": "internal_user",
}
- return returned_dict
+ non_null_dict = {}
+ for k, v in returned_dict.items():
+ if v is not None:
+ non_null_dict[k] = v
+ return non_null_dict
async def add_new_member(
diff --git a/litellm/tests/test_key_generate_prisma.py b/litellm/tests/test_key_generate_prisma.py
index 93110ffb6e3..344c9691b16 100644
--- a/litellm/tests/test_key_generate_prisma.py
+++ b/litellm/tests/test_key_generate_prisma.py
@@ -1236,7 +1236,7 @@ def test_generate_and_update_key(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
- pytest.fail(f"An exception occurred - {str(e)}")
+ pytest.fail(f"An exception occurred - {str(e)}\n{traceback.format_exc()}")
def test_key_generate_with_custom_auth(prisma_client):