From c794c09679b5366a3473b90fa848cf64ed11a47c Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Tue, 30 Apr 2024 14:34:54 -0700 Subject: [PATCH] Disambiguate invalid model name errors because that error can be thrown in several different places, so knowing the function it's being thrown from can be very useul for debugging. --- litellm/proxy/proxy_server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 29f3c41db..f738f3109 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -3486,7 +3486,7 @@ async def completion( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "completion: Invalid model name passed in model=" + data.get("model", "") }, ) @@ -3735,7 +3735,7 @@ async def chat_completion( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "chat_completion: Invalid model name passed in model=" + data.get("model", "") }, ) @@ -3966,7 +3966,7 @@ async def embeddings( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "embeddings: Invalid model name passed in model=" + data.get("model", "") }, ) @@ -4122,7 +4122,7 @@ async def image_generation( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "image_generation: Invalid model name passed in model=" + data.get("model", "") }, ) @@ -4297,7 +4297,7 @@ async def audio_transcriptions( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "audio_transcriptions: Invalid model name passed in model=" + data.get("model", "") }, ) @@ -4463,7 +4463,7 @@ async def moderations( raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail={ - "error": "Invalid model name passed in model=" + "error": "moderations: Invalid model name passed in model=" + data.get("model", "") }, )