From e3223639e4024e86516998a06f744d48dba12b2f Mon Sep 17 00:00:00 2001 From: Chesars Date: Fri, 7 Nov 2025 10:32:24 -0300 Subject: [PATCH] Fix MyPy type errors for aembedding call_type Add "aembedding" to Literal type hints in ProxyLogging methods: - pre_call_hook overloads (lines 872, 893, 913) - during_call_hook (line 1052) - _process_guardrail_callback (line 803) Add type: ignore comments where ProxyLogging calls CustomLogger callbacks (lines 1021, 1106) to handle type mismatch between ProxyLogging's broader Literal (includes "aembedding") and CustomLogger's narrower Literal (doesn't include "aembedding"). Related to PR #16328 which changed embeddings endpoint to use call_type="aembedding" for async operations. --- litellm/proxy/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 62ab69c32ea6..d5a47ca30c13 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -800,6 +800,7 @@ async def _process_guardrail_callback( "completion", "text_completion", "embeddings", + "aembedding", "image_generation", "moderation", "audio_transcription", @@ -869,6 +870,7 @@ async def pre_call_hook( "completion", "text_completion", "embeddings", + "aembedding", "image_generation", "moderation", "audio_transcription", @@ -889,6 +891,7 @@ async def pre_call_hook( "completion", "text_completion", "embeddings", + "aembedding", "image_generation", "moderation", "audio_transcription", @@ -908,6 +911,7 @@ async def pre_call_hook( "completion", "text_completion", "embeddings", + "aembedding", "image_generation", "moderation", "audio_transcription", @@ -1014,7 +1018,7 @@ async def pre_call_hook( user_api_key_dict=user_api_key_dict, cache=self.call_details["user_api_key_cache"], data=data, # type: ignore - call_type=call_type, + call_type=call_type, # type: ignore ) if response is not None: data = await self.process_pre_call_hook_response( @@ -1046,6 +1050,7 @@ async def during_call_hook( "completion", "responses", "embeddings", + "aembedding", "image_generation", "moderation", "audio_transcription", @@ -1098,7 +1103,7 @@ async def during_call_hook( callback.async_moderation_hook( data=data, user_api_key_dict=user_api_key_auth_dict, # type: ignore - call_type=call_type, + call_type=call_type, # type: ignore ) )