mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
Merge 7a2a158e71 into ec94a1f82a
This commit is contained in:
commit
f26ba03808
2 changed files with 32 additions and 1 deletions
|
|
@ -477,7 +477,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM):
|
|||
additional_args={"complete_input_dict": data},
|
||||
original_response=str(e),
|
||||
)
|
||||
raise AzureOpenAIError(status_code=500, message=str(e))
|
||||
raise
|
||||
except Exception as e:
|
||||
message: Final = getattr(e, "message", str(e))
|
||||
body: Final = getattr(e, "body", None)
|
||||
|
|
|
|||
31
tests/test_litellm/llms/azure/test_azure.py
Normal file
31
tests/test_litellm/llms/azure/test_azure.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from openai import AsyncAzureOpenAI
|
||||
|
||||
sys.path.insert(0, os.path.abspath("../../../.."))
|
||||
|
||||
import litellm
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_acompletion_propagates_cancelled_error():
|
||||
client = AsyncAzureOpenAI(
|
||||
api_key="fake-key",
|
||||
api_version="2024-02-01",
|
||||
azure_endpoint="https://fake-resource.openai.azure.com",
|
||||
)
|
||||
|
||||
async def cancelled_create(**kwargs):
|
||||
raise asyncio.CancelledError()
|
||||
|
||||
client.chat.completions.with_raw_response.create = cancelled_create
|
||||
|
||||
with pytest.raises(asyncio.CancelledError):
|
||||
await litellm.acompletion(
|
||||
model="azure/fake-deployment",
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
client=client,
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue