From c454dbec3089d8ef31df437aabf4ca277892885e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 1 Apr 2025 19:03:50 -0700 Subject: [PATCH] get_supported_openai_params for o-1 series models --- .../openai/chat/o_series_transformation.py | 22 ------------------- tests/llm_translation/test_optional_params.py | 9 ++++++++ 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/litellm/llms/openai/chat/o_series_transformation.py b/litellm/llms/openai/chat/o_series_transformation.py index b2ffda6e7de..e2d33f635da 100644 --- a/litellm/llms/openai/chat/o_series_transformation.py +++ b/litellm/llms/openai/chat/o_series_transformation.py @@ -71,28 +71,6 @@ class OpenAIOSeriesConfig(OpenAIGPTConfig): verbose_logger.debug( f"Unable to infer model provider for model={model}, defaulting to openai for o1 supported param check" ) - custom_llm_provider = "openai" - - _supports_function_calling = supports_function_calling( - model, custom_llm_provider - ) - _supports_response_schema = supports_response_schema(model, custom_llm_provider) - _supports_parallel_tool_calls = supports_parallel_function_calling( - model, custom_llm_provider - ) - - if not _supports_function_calling: - non_supported_params.append("tools") - non_supported_params.append("tool_choice") - non_supported_params.append("function_call") - non_supported_params.append("functions") - - if not _supports_parallel_tool_calls: - non_supported_params.append("parallel_tool_calls") - - if not _supports_response_schema: - non_supported_params.append("response_format") - return [ param for param in all_openai_params if param not in non_supported_params ] diff --git a/tests/llm_translation/test_optional_params.py b/tests/llm_translation/test_optional_params.py index f59d4349022..b90e9a4377c 100644 --- a/tests/llm_translation/test_optional_params.py +++ b/tests/llm_translation/test_optional_params.py @@ -1379,3 +1379,12 @@ def test_azure_modalities_param(): ) assert optional_params["modalities"] == ["text", "audio"] assert optional_params["audio"] == {"type": "audio_input", "input": "test.wav"} + + +def test_azure_response_format_param(): + optional_params = litellm.get_optional_params( + model="azure/o_series/test-o3-mini", + custom_llm_provider="azure/o_series", + tools= [{'type': 'function', 'function': {'name': 'get_current_time', 'description': 'Get the current time in a given location.', 'parameters': {'type': 'object', 'properties': {'location': {'type': 'string', 'description': 'The city name, e.g. San Francisco'}}, 'required': ['location']}}}] + ) + assert optional_params["tools"] == [{'type': 'function', 'function': {'name': 'get_current_time', 'description': 'Get the current time in a given location.', 'parameters': {'type': 'object', 'properties': {'location': {'type': 'string', 'description': 'The city name, e.g. San Francisco'}}, 'required': ['location']}}}] \ No newline at end of file