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: flaky passthrough tests (#14692)
Mubashir Osmania7a63819260f
diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex 6936924fe17..44f08714d80 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -556,7 +556,7 @@ def exception_type( # type: ignore # noqa: PLR0915model=model,llm_provider="anthropic",)- elif "overloaded_error" in error_str:+ elif "overloaded_error" in error_str or "Overloaded" in error_str:exception_mapping_worked = Trueraise InternalServerError(message="AnthropicError - {}".format(error_str),diff --git a/tests/otel_tests/test_prometheus.py b/tests/otel_tests/test_prometheus.pyindex c811a6c020d..3a9de555544 100644--- a/tests/otel_tests/test_prometheus.py+++ b/tests/otel_tests/test_prometheus.py@@ -252,8 +252,8 @@ async def create_test_team(async def create_test_user(session: aiohttp.ClientSession, user_data: Dict[str, Any]-) -> str:- """Create a new user and return the user_id"""+) -> Dict[str, Any]:+ """Create a new user and return the user info"""url = "http://0.0.0.0:4000/user/new"headers = {"Authorization": "Bearer sk-1234",@@ -579,7 +579,7 @@ async def test_user_email_in_all_required_metrics():- litellm_input_tokens_metric_total- litellm_output_tokens_metric_total- litellm_requests_metric_total- - litellm_spend_metric_total+ - litellm_spend_metric"""async with aiohttp.ClientSession() as session:# Create a user with user_email@@ -611,12 +611,12 @@ async def test_user_email_in_all_required_metrics():"litellm_input_tokens_metric_total","litellm_output_tokens_metric_total","litellm_requests_metric_total",- "litellm_spend_metric_total"+ "litellm_spend_metric"]+ import refor metric_name in required_metrics_with_user_email:# Check that the metric exists and contains user_email label- import re# Look for the metric with user_email in its labelspattern = rf'{metric_name}{{[^}}]*user_email="{re.escape(user_email)}"[^}}]*}}'matches = re.findall(pattern, metrics_text)diff --git a/tests/proxy_unit_tests/test_key_generate_prisma.py b/tests/proxy_unit_tests/test_key_generate_prisma.pyindex 22bf4043425..be29ce1e343 100644--- a/tests/proxy_unit_tests/test_key_generate_prisma.py+++ b/tests/proxy_unit_tests/test_key_generate_prisma.py@@ -3428,6 +3428,16 @@ async def test_list_keys(prisma_client):),page=1,size=10,+ user_id=None,+ team_id=None,+ organization_id=None,+ key_hash=None,+ key_alias=None,+ return_full_object=False,+ include_team_keys=False,+ include_created_by_keys=False,+ sort_by=None,+ sort_order="desc",)print("response=", response)assert "keys" in response@@ -3442,6 +3452,16 @@ async def test_list_keys(prisma_client):UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN.value),page=1,size=2,+ user_id=None,+ team_id=None,+ organization_id=None,+ key_hash=None,+ key_alias=None,+ return_full_object=False,+ include_team_keys=False,+ include_created_by_keys=False,+ sort_by=None,+ sort_order="desc",)print("pagination response=", response)assert len(response["keys"]) == 2@@ -3470,9 +3490,18 @@ async def test_list_keys(prisma_client):response = await list_keys(request,UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN.value),- user_id=user_id,page=1,size=10,+ user_id=user_id,+ team_id=None,+ organization_id=None,+ key_hash=None,+ key_alias=None,+ return_full_object=False,+ include_team_keys=False,+ include_created_by_keys=False,+ sort_by=None,+ sort_order="desc",)print("filtered user_id response=", response)assert len(response["keys"]) == 1@@ -3482,9 +3511,18 @@ async def test_list_keys(prisma_client):response = await list_keys(request,UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN.value),- key_alias=key_alias,page=1,size=10,+ user_id=None,+ team_id=None,+ organization_id=None,+ key_hash=None,+ key_alias=key_alias,+ return_full_object=False,+ include_team_keys=False,+ include_created_by_keys=False,+ sort_by=None,+ sort_order="desc",)assert len(response["keys"]) == 1assert _key in response["keys"]