test_o1_parallel_tool_calls

This commit is contained in:
Ishaan Jaffer 2026-02-14 10:47:30 -08:00
parent d60a832aae
commit ad910de1e3
5 changed files with 35 additions and 6 deletions

View file

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

View file

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

View file

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

View file

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

View file

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