forked from phoenix/litellm-mirror
fix(azure.py): correctly raise async exceptions
This commit is contained in:
parent
87fca1808a
commit
812f9ca1b3
2 changed files with 5 additions and 1 deletions
|
@ -262,7 +262,10 @@ class AzureChatCompletion(BaseLLM):
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise e
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AzureOpenAIError(status_code=500, message=str(e))
|
if hasattr(e, "status_code"):
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
raise AzureOpenAIError(status_code=500, message=str(e))
|
||||||
|
|
||||||
def streaming(self,
|
def streaming(self,
|
||||||
logging_obj,
|
logging_obj,
|
||||||
|
|
|
@ -68,6 +68,7 @@ def test_chat_completion_exception_azure(client):
|
||||||
# make an openai client to call _make_status_error_from_response
|
# make an openai client to call _make_status_error_from_response
|
||||||
openai_client = openai.OpenAI(api_key="anything")
|
openai_client = openai.OpenAI(api_key="anything")
|
||||||
openai_exception = openai_client._make_status_error_from_response(response=response)
|
openai_exception = openai_client._make_status_error_from_response(response=response)
|
||||||
|
print(openai_exception)
|
||||||
assert isinstance(openai_exception, openai.AuthenticationError)
|
assert isinstance(openai_exception, openai.AuthenticationError)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue