diff --git a/litellm/llms/openai.py b/litellm/llms/openai.py index d1e0d14ba..25e2e518c 100644 --- a/litellm/llms/openai.py +++ b/litellm/llms/openai.py @@ -968,7 +968,7 @@ class OpenAIChatCompletion(BaseLLM): except openai.UnprocessableEntityError as e: ## check if body contains unprocessable params - related issue https://github.com/BerriAI/litellm/issues/4800 if litellm.drop_params is True or drop_params is True: - if e.body is not None and e.body.get("detail"): # type: ignore + if e.body is not None and isinstance(e.body, dict) and e.body.get("detail"): # type: ignore detail = e.body.get("detail") # type: ignore invalid_params: List[str] = [] if ( @@ -1100,7 +1100,7 @@ class OpenAIChatCompletion(BaseLLM): except openai.UnprocessableEntityError as e: ## check if body contains unprocessable params - related issue https://github.com/BerriAI/litellm/issues/4800 if litellm.drop_params is True or drop_params is True: - if e.body is not None and e.body.get("detail"): # type: ignore + if e.body is not None and isinstance(e.body, dict) and e.body.get("detail"): # type: ignore detail = e.body.get("detail") # type: ignore invalid_params: List[str] = [] if ( @@ -1231,7 +1231,7 @@ class OpenAIChatCompletion(BaseLLM): except openai.UnprocessableEntityError as e: ## check if body contains unprocessable params - related issue https://github.com/BerriAI/litellm/issues/4800 if litellm.drop_params is True or drop_params is True: - if e.body is not None and e.body.get("detail"): # type: ignore + if e.body is not None and isinstance(e.body, dict) and e.body.get("detail"): # type: ignore detail = e.body.get("detail") # type: ignore invalid_params: List[str] = [] if (