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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(proxy): keep bulk user row errors free of the tuple length message
ryan8e83e91275d4
diff --git a/litellm/types/proxy/management_endpoints/internal_user_endpoints.py b/litellm/types/proxy/management_endpoints/internal_user_endpoints.pyindex f6a2c173ad5..3b4a2a417f2 100644--- a/litellm/types/proxy/management_endpoints/internal_user_endpoints.py+++ b/litellm/types/proxy/management_endpoints/internal_user_endpoints.py@@ -1,4 +1,4 @@-from collections.abc import Mapping+from collections.abc import Mapping, Sequencefrom typing import Any, Final, Literalfrom pydantic import BaseModel, ConfigDict, Field, field_validator@@ -107,7 +107,7 @@ class BulkNewUserItem(NewUserRequest):class BulkNewUserRequest(BaseModel):model_config = ConfigDict(extra="forbid")- users: tuple[BulkNewUserItem, ...] = Field(min_length=1, max_length=MAX_BULK_NEW_USERS)+ users: Sequence[BulkNewUserItem] = Field(min_length=1, max_length=MAX_BULK_NEW_USERS)class UserCreateResult(BaseModel):diff --git a/tests/test_litellm/proxy/management_endpoints/management_v1/test_users.py b/tests/test_litellm/proxy/management_endpoints/management_v1/test_users.pyindex b61e639e453..edd1d315093 100644--- a/tests/test_litellm/proxy/management_endpoints/management_v1/test_users.py+++ b/tests/test_litellm/proxy/management_endpoints/management_v1/test_users.py@@ -79,16 +79,16 @@ def test_returns_one_result_per_row_in_order_inside_the_data_meta_envelope(prismdef test_an_unknown_field_anywhere_in_the_body_is_a_422_problem(prisma, as_proxy_admin):- for body in (- {"users": [{"user_email": "[email protected]", "user_emial": "typo"}]},- {"users": [{"user_email": "[email protected]"}], "dry_run": True},+ for body, field in (+ ({"users": [{"user_email": "[email protected]", "user_emial": "typo"}]}, "users.0.user_emial"),+ ({"users": [{"user_email": "[email protected]"}], "dry_run": True}, "dry_run"),):response = _post(body)assert response.status_code == 422, bodyassert response.headers["content-type"] == "application/problem+json"assert response.json()["type"] == "urn:litellm:error:invalid-request-body"- assert "Extra inputs are not permitted" in response.json()["detail"]+ assert response.json()["detail"] == f"{field}: Extra inputs are not permitted"assert prisma.db.litellm_usertable.rows == {}