forked from phoenix/litellm-mirror
fix(openai.py): fix error handling
This commit is contained in:
parent
20be76123b
commit
4bf893afe1
1 changed files with 5 additions and 12 deletions
|
@ -1160,18 +1160,11 @@ class OpenAIChatCompletion(BaseLLM):
|
||||||
"complete_input_dict": data,
|
"complete_input_dict": data,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
try:
|
|
||||||
headers, response = self.make_sync_openai_chat_completion_request(
|
headers, response = self.make_sync_openai_chat_completion_request(
|
||||||
openai_client=openai_client,
|
openai_client=openai_client,
|
||||||
data=data,
|
data=data,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
|
||||||
status_code = getattr(e, "status_code", 500)
|
|
||||||
error_headers = getattr(e, "headers", None)
|
|
||||||
raise OpenAIError(
|
|
||||||
status_code=status_code, message=str(e), headers=error_headers
|
|
||||||
)
|
|
||||||
|
|
||||||
logging_obj.model_call_details["response_headers"] = headers
|
logging_obj.model_call_details["response_headers"] = headers
|
||||||
streamwrapper = CustomStreamWrapper(
|
streamwrapper = CustomStreamWrapper(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue