From 2fa2de88428489a590e4760a8950b74410c5dca9 Mon Sep 17 00:00:00 2001 From: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com> Date: Mon, 10 Aug 2026 12:40:47 +0000 Subject: [PATCH 1/2] fix(azure): forward context_management on Azure Responses API AzureOpenAIResponsesAPIConfig filtered context_management out of the supported params, so with drop_params it was silently dropped and callers got no server-side compaction and no error. Azure now documents context_management on the Responses API, so remove the Azure-specific exclusion and inherit the base supported params. The O-series subclass keeps dropping temperature via super(). Fixes #36391 --- litellm/llms/azure/responses/transformation.py | 10 ---------- .../azure/response/test_azure_transformation.py | 16 +++++++++------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index 7fe12138ebc..2d829b66649 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -23,9 +23,6 @@ else: class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): - # Parameters not supported by Azure Responses API - AZURE_UNSUPPORTED_PARAMS = ["context_management"] - @property def custom_llm_provider(self) -> LlmProviders: return LlmProviders.AZURE @@ -38,13 +35,6 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): def _effort_resolves_to_none(model: str, effort: str | None) -> bool: return AzureOpenAIGPT5Config.effort_resolves_to_none(model, effort) - def get_supported_openai_params(self, model: str) -> list: - """ - Azure Responses API does not support context_management (compaction). - """ - base_supported_params: Final = super().get_supported_openai_params(model) - return [param for param in base_supported_params if param not in self.AZURE_UNSUPPORTED_PARAMS] - def validate_environment(self, headers: dict, model: str, litellm_params: GenericLiteLLMParams | None) -> dict: return BaseAzureLLM._base_validate_azure_environment(headers=headers, litellm_params=litellm_params) diff --git a/tests/test_litellm/llms/azure/response/test_azure_transformation.py b/tests/test_litellm/llms/azure/response/test_azure_transformation.py index 0cac2705ab0..692c404352a 100644 --- a/tests/test_litellm/llms/azure/response/test_azure_transformation.py +++ b/tests/test_litellm/llms/azure/response/test_azure_transformation.py @@ -528,14 +528,16 @@ class TestAzureResponsesAPIConfig: assert "tools" not in response_api_params - def test_azure_responses_api_context_management_unsupported(self): - """Test that context_management is not in Azure supported params. + def test_azure_responses_api_supports_context_management(self): + """Regression for #36391: Azure Responses API supports server-side compaction.""" + supported_params = self.config.get_supported_openai_params("gpt-5.1") - Azure does not support context_management (compaction). It should be - excluded from supported params so it gets dropped. - """ - supported = self.config.get_supported_openai_params(self.model) - assert "context_management" not in supported + assert "context_management" in supported_params + + o_series_config = AzureOpenAIOSeriesResponsesAPIConfig() + o_series_supported = o_series_config.get_supported_openai_params("o_series/gpt-o1") + assert "context_management" in o_series_supported + assert "temperature" not in o_series_supported def _anyof_tool(self): return { From c0289ad3aea8c1d62f78f6def947fd62462c69f1 Mon Sep 17 00:00:00 2001 From: ousamabenyounes Date: Mon, 19 Oct 2026 05:52:57 +0000 Subject: [PATCH 2/2] test(azure): drop docstring from context_management test --- tests/unit/llms/azure/response/test_azure_transformation.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/llms/azure/response/test_azure_transformation.py b/tests/unit/llms/azure/response/test_azure_transformation.py index 5c5b5492e39..f1a4bf4868a 100644 --- a/tests/unit/llms/azure/response/test_azure_transformation.py +++ b/tests/unit/llms/azure/response/test_azure_transformation.py @@ -609,7 +609,6 @@ class TestAzureResponsesAPIConfig: assert "tools" not in response_api_params def test_azure_responses_api_supports_context_management(self): - """Regression for #36391: Azure Responses API supports server-side compaction.""" supported_params = self.config.get_supported_openai_params("gpt-5.1") assert "context_management" in supported_params