From 3faf73120fc6608e7ce6616871eb430c15133055 Mon Sep 17 00:00:00 2001 From: Daniele Antonio Maggio <1955514+danigian@users.noreply.github.com> Date: Tue, 28 May 2024 12:07:33 +0200 Subject: [PATCH] fix: Remove wrong `response_format` override in `AzureChatPromptExecutionSettings` class --- .../azure_chat_prompt_execution_settings.py | 1 - .../connectors/open_ai/test_openai_request_settings.py | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/azure_chat_prompt_execution_settings.py b/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/azure_chat_prompt_execution_settings.py index d5c28f6f0b05..68c2c810c4dc 100644 --- a/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/azure_chat_prompt_execution_settings.py +++ b/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/azure_chat_prompt_execution_settings.py @@ -98,5 +98,4 @@ def __getitem__(self, item): class AzureChatPromptExecutionSettings(OpenAIChatPromptExecutionSettings): """Specific settings for the Azure OpenAI Chat Completion endpoint.""" - response_format: str | None = None extra_body: dict[str, Any] | ExtraBody | None = None diff --git a/python/tests/unit/connectors/open_ai/test_openai_request_settings.py b/python/tests/unit/connectors/open_ai/test_openai_request_settings.py index 3df08a5a0873..a27ec9fba71c 100644 --- a/python/tests/unit/connectors/open_ai/test_openai_request_settings.py +++ b/python/tests/unit/connectors/open_ai/test_openai_request_settings.py @@ -263,3 +263,10 @@ def test_azure_open_ai_chat_prompt_execution_settings_with_aisearch_data_sources } settings = AzureChatPromptExecutionSettings.model_validate(input_dict, strict=True, from_attributes=True) assert settings.extra_body["dataSources"][0]["type"] == "AzureCognitiveSearch" + + +def test_azure_open_ai_chat_prompt_execution_settings_with_response_format_json(): + response_format = {"type": "json_object"} + settings = AzureChatPromptExecutionSettings(response_format=response_format) + options = settings.prepare_settings_dict() + assert options["response_format"] == response_format