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
test(proxy): type the traceback-recording hook to match CustomLogger
mateo-berri27c55a21d986
diff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.pyindex 51176c2b251..dcf18e773e8 100644--- a/tests/test_litellm/proxy/test_proxy_utils.py+++ b/tests/test_litellm/proxy/test_proxy_utils.py@@ -7,7 +7,7 @@ from fastapi import HTTPExceptionfrom litellm.caching.caching import DualCachefrom litellm.integrations.custom_guardrail import CustomGuardrailfrom litellm.integrations.custom_logger import CustomLogger-from litellm.proxy._types import ProxyErrorTypes+from litellm.proxy._types import ProxyErrorTypes, UserAPIKeyAuthfrom litellm.proxy.utils import ProxyLoggingfrom litellm.types.guardrails import GuardrailEventHooks@@ -1923,11 +1923,17 @@ async def test_proxy_only_error_5xx_keeps_traceback_and_runs_sync_callbacks(monkclass _TracebackRecordingLogger(CustomLogger):- def __init__(self):+ def __init__(self) -> None:super().__init__()self.received_traceback: str | None = None- async def async_post_call_failure_hook(self, request_data, original_exception, user_api_key_dict, traceback_str=None):+ async def async_post_call_failure_hook(+ self,+ request_data: dict,+ original_exception: Exception,+ user_api_key_dict: UserAPIKeyAuth,+ traceback_str: str | None = None,+ ) -> HTTPException | None:self.received_traceback = traceback_strreturn None@@ -1942,8 +1948,6 @@ async def test_post_call_failure_hook_redacts_traceback_before_callbacks(monkeypimport httpx- from litellm.proxy._types import UserAPIKeyAuth-provider_key = "AIza" + "S" * 35upstream_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini:generateContent?key={provider_key}"response = httpx.Response(400, request=httpx.Request("POST", upstream_url))