Skip to content

Commit 5cd1cae

Browse files
ChesarsLingXuanYin
authored andcommitted
Fix MyPy type errors for aembedding call_type (BerriAI#16360)
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 BerriAI#16328 which changed embeddings endpoint to use call_type="aembedding" for async operations.
1 parent f6ddfeb commit 5cd1cae

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

litellm/proxy/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ async def _process_guardrail_callback(
800800
"completion",
801801
"text_completion",
802802
"embeddings",
803+
"aembedding",
803804
"image_generation",
804805
"moderation",
805806
"audio_transcription",
@@ -869,6 +870,7 @@ async def pre_call_hook(
869870
"completion",
870871
"text_completion",
871872
"embeddings",
873+
"aembedding",
872874
"image_generation",
873875
"moderation",
874876
"audio_transcription",
@@ -889,6 +891,7 @@ async def pre_call_hook(
889891
"completion",
890892
"text_completion",
891893
"embeddings",
894+
"aembedding",
892895
"image_generation",
893896
"moderation",
894897
"audio_transcription",
@@ -908,6 +911,7 @@ async def pre_call_hook(
908911
"completion",
909912
"text_completion",
910913
"embeddings",
914+
"aembedding",
911915
"image_generation",
912916
"moderation",
913917
"audio_transcription",
@@ -1014,7 +1018,7 @@ async def pre_call_hook(
10141018
user_api_key_dict=user_api_key_dict,
10151019
cache=self.call_details["user_api_key_cache"],
10161020
data=data, # type: ignore
1017-
call_type=call_type,
1021+
call_type=call_type, # type: ignore
10181022
)
10191023
if response is not None:
10201024
data = await self.process_pre_call_hook_response(
@@ -1046,6 +1050,7 @@ async def during_call_hook(
10461050
"completion",
10471051
"responses",
10481052
"embeddings",
1053+
"aembedding",
10491054
"image_generation",
10501055
"moderation",
10511056
"audio_transcription",
@@ -1098,7 +1103,7 @@ async def during_call_hook(
10981103
callback.async_moderation_hook(
10991104
data=data,
11001105
user_api_key_dict=user_api_key_auth_dict, # type: ignore
1101-
call_type=call_type,
1106+
call_type=call_type, # type: ignore
11021107
)
11031108
)
11041109

0 commit comments

Comments
 (0)