mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix(openai.py): check if error body is a dictionary before indexing in
This commit is contained in:
parent
eb32e8fafc
commit
dc9dcfefac
1 changed files with 3 additions and 3 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue