From c3922f55239be97544a37c07cad1d850b19a6f53 Mon Sep 17 00:00:00 2001 From: eavanvalkenburg Date: Fri, 6 Dec 2024 15:51:08 +0100 Subject: [PATCH] bugfix for tool calling without passing specific PES --- .../connectors/ai/chat_completion_client_base.py | 6 ++++++ python/uv.lock | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/semantic_kernel/connectors/ai/chat_completion_client_base.py b/python/semantic_kernel/connectors/ai/chat_completion_client_base.py index 1677104e1d49b..1964c9ca9f47c 100644 --- a/python/semantic_kernel/connectors/ai/chat_completion_client_base.py +++ b/python/semantic_kernel/connectors/ai/chat_completion_client_base.py @@ -99,6 +99,9 @@ async def get_chat_message_contents( """ # Create a copy of the settings to avoid modifying the original settings settings = copy.deepcopy(settings) + # Later on, we already use the tools or equivalant settings, we cast here. + if not isinstance(settings, self.get_prompt_execution_settings_class()): + settings = self.get_prompt_execution_settings_from_settings(settings) if not self.SUPPORTS_FUNCTION_CALLING: return await self._inner_get_chat_message_contents(chat_history, settings) @@ -211,6 +214,9 @@ async def get_streaming_chat_message_contents( """ # Create a copy of the settings to avoid modifying the original settings settings = copy.deepcopy(settings) + # Later on, we already use the tools or equivalant settings, we cast here. + if not isinstance(settings, self.get_prompt_execution_settings_class()): + settings = self.get_prompt_execution_settings_from_settings(settings) if not self.SUPPORTS_FUNCTION_CALLING: async for streaming_chat_message_contents in self._inner_get_streaming_chat_message_contents( diff --git a/python/uv.lock b/python/uv.lock index 470d3184eefe4..09f00bbd2ec1c 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -4696,7 +4696,7 @@ wheels = [ [[package]] name = "semantic-kernel" -version = "1.16.0" +version = "1.17.0" source = { editable = "." } dependencies = [ { name = "aiohttp", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" },