From 96d4466a8f487bf9837e72dc335ae34c9c67558f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 12 Aug 2024 11:29:49 -0700 Subject: [PATCH] fix(azure.py): return response headers acompletion + acompletion w/ streaming Fixes https://github.com/BerriAI/litellm/issues/2440#issuecomment-2283259187 --- litellm/llms/azure.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/litellm/llms/azure.py b/litellm/llms/azure.py index 9df67c26e1c..876d3b899a7 100644 --- a/litellm/llms/azure.py +++ b/litellm/llms/azure.py @@ -745,6 +745,8 @@ class AzureChatCompletion(BaseLLM): return convert_to_model_response_object( response_object=stringified_response, model_response_object=model_response, + hidden_params={"headers": headers}, + _response_headers=headers, ) except AzureOpenAIError as e: ## LOGGING @@ -905,6 +907,7 @@ class AzureChatCompletion(BaseLLM): model=model, custom_llm_provider="azure", logging_obj=logging_obj, + _response_headers=headers, ) return streamwrapper ## DO NOT make this into an async for ... loop, it will yield an async generator, which won't raise errors if the response fails except Exception as e: