forked from phoenix/litellm-mirror
fix(openai.py): check if error body is a dictionary before indexing in
This commit is contained in:
parent
92d3b27a6b
commit
f4a388f217
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