diff --git a/litellm/llms/azure.py b/litellm/llms/azure.py index 8932e44941..69217fac2c 100644 --- a/litellm/llms/azure.py +++ b/litellm/llms/azure.py @@ -1150,7 +1150,13 @@ class AzureChatCompletion(BaseLLM): error_data = response.json() raise AzureOpenAIError(status_code=400, message=json.dumps(error_data)) - return response + result = response.json()["result"] + return httpx.Response( + status_code=200, + headers=response.headers, + content=json.dumps(result).encode("utf-8"), + request=httpx.Request(method="POST", url="https://api.openai.com/v1"), + ) return await async_handler.post( url=api_base, json=data, @@ -1249,7 +1255,13 @@ class AzureChatCompletion(BaseLLM): error_data = response.json() raise AzureOpenAIError(status_code=400, message=json.dumps(error_data)) - return response + result = response.json()["result"] + return httpx.Response( + status_code=200, + headers=response.headers, + content=json.dumps(result).encode("utf-8"), + request=httpx.Request(method="POST", url="https://api.openai.com/v1"), + ) return sync_handler.post( url=api_base, json=data, @@ -1324,7 +1336,7 @@ class AzureChatCompletion(BaseLLM): api_key=api_key, data=data, ) - response = httpx_response.json()["result"] + response = httpx_response.json() stringified_response = response ## LOGGING @@ -1431,7 +1443,7 @@ class AzureChatCompletion(BaseLLM): api_key=api_key or "", data=data, ) - response = httpx_response.json()["result"] + response = httpx_response.json() ## LOGGING logging_obj.post_call( diff --git a/litellm/tests/test_image_generation.py b/litellm/tests/test_image_generation.py index 67857b8c86..4ff029ca90 100644 --- a/litellm/tests/test_image_generation.py +++ b/litellm/tests/test_image_generation.py @@ -44,7 +44,9 @@ def test_image_generation_openai(): @pytest.mark.parametrize( "sync_mode", - [True, False], + [ + True, + ], # False ) # @pytest.mark.asyncio async def test_image_generation_azure(sync_mode):