diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index 44ce368fd49..78631d38005 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -1,5 +1,5 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union from copy import deepcopy +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union import httpx from openai.types.responses import ResponseReasoningItem @@ -21,10 +21,25 @@ 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 + def get_supported_openai_params(self, model: str) -> list: + """ + Azure Responses API does not support context_management (compaction). + """ + base_supported_params = 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: Optional[GenericLiteLLMParams] ) -> dict: diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 64eceae3297..95d8ba2ff60 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -23204,7 +23204,7 @@ "mode": "chat", "output_cost_per_token": 6e-05, "supports_function_calling": true, - "supports_parallel_function_calling": true, + "supports_parallel_function_calling": false, "supports_pdf_input": true, "supports_prompt_caching": true, "supports_reasoning": true, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 64eceae3297..95d8ba2ff60 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -23204,7 +23204,7 @@ "mode": "chat", "output_cost_per_token": 6e-05, "supports_function_calling": true, - "supports_parallel_function_calling": true, + "supports_parallel_function_calling": false, "supports_pdf_input": true, "supports_prompt_caching": true, "supports_reasoning": true, diff --git a/tests/llm_responses_api_testing/base_responses_api.py b/tests/llm_responses_api_testing/base_responses_api.py index 7ac83753d17..a5b2370fdd9 100644 --- a/tests/llm_responses_api_testing/base_responses_api.py +++ b/tests/llm_responses_api_testing/base_responses_api.py @@ -694,10 +694,14 @@ class BaseResponsesAPITest(ABC): """ base_completion_call_args = self.get_base_completion_call_args() model = base_completion_call_args.get("model") or "" - # Only run with context_management for OpenAI (OAI) for now - if "openai/" not in str(model) and "azure/" not in str(model): + # Azure does not support compaction context_management (only clear_tool_results) + if "azure/" in str(model): pytest.skip( - "context_management server-side compaction e2e is only run for OpenAI/Azure" + "context_management compaction is not supported on Azure" + ) + if "openai/" not in str(model): + pytest.skip( + "context_management server-side compaction e2e is only run for OpenAI" ) context_management = [{"type": "compaction", "compact_threshold": 200000}] try: 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 f54724b859f..9519b7c8a5b 100644 --- a/tests/test_litellm/llms/azure/response/test_azure_transformation.py +++ b/tests/test_litellm/llms/azure/response/test_azure_transformation.py @@ -318,6 +318,7 @@ class TestAzureResponsesAPIConfig: def test_azure_cancel_response_api_response(self): """Test Azure cancel response API response transformation""" from unittest.mock import Mock + from litellm.types.llms.openai import ResponsesAPIResponse # Mock response @@ -492,3 +493,12 @@ 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. + + 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