This commit is contained in:
devin-ai-integration[bot] 2026-08-27 19:06:57 -05:00 committed by GitHub
commit f26ba03808
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 1 deletions

View file

@ -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)

View 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,
)