From 65958d489af5e28ad48881bc4adb6d85537a6143 Mon Sep 17 00:00:00 2001 From: eavanvalkenburg Date: Wed, 12 Feb 2025 10:57:18 +0100 Subject: [PATCH 1/2] set openai package to newer version and removed default value of parallel tool calls --- python/pyproject.toml | 2 +- .../open_ai_prompt_execution_settings.py | 2 +- python/uv.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index a0122a2a2f29..b4b0a30672a2 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "numpy >= 1.25.0; python_version < '3.12'", "numpy >= 1.26.0; python_version >= '3.12'", # openai connector - "openai ~= 1.0", + "openai ~= 1.61", # openapi and swagger "openapi_core >= 0.18,<0.20", # OpenTelemetry diff --git a/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/open_ai_prompt_execution_settings.py b/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/open_ai_prompt_execution_settings.py index d2b37d44bb40..b1a241d2a5d3 100644 --- a/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/open_ai_prompt_execution_settings.py +++ b/python/semantic_kernel/connectors/ai/open_ai/prompt_execution_settings/open_ai_prompt_execution_settings.py @@ -66,7 +66,7 @@ class OpenAIChatPromptExecutionSettings(OpenAIPromptExecutionSettings): messages: Annotated[ list[dict[str, Any]] | None, Field(description="Do not set this manually. It is set by the service.") ] = None - parallel_tool_calls: bool | None = True + parallel_tool_calls: bool | None = None tools: Annotated[ list[dict[str, Any]] | None, Field( diff --git a/python/uv.lock b/python/uv.lock index 854a5926a379..0486870c0920 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -2896,7 +2896,7 @@ wheels = [ [[package]] name = "openai" -version = "1.60.2" +version = "1.61.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" }, @@ -2908,9 +2908,9 @@ dependencies = [ { name = "tqdm", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" }, { name = "typing-extensions", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/08/ae/8d9706b8ff2363287b4a8807de2dd29cdbdad5424e9d05d345df724320f5/openai-1.60.2.tar.gz", hash = "sha256:a8f843e10f2855713007f491d96afb2694b11b5e02cb97c7d01a0be60bc5bb51", size = 348185 } +sdist = { url = "https://files.pythonhosted.org/packages/d9/cf/61e71ce64cf0a38f029da0f9a5f10c9fa0e69a7a977b537126dac50adfea/openai-1.61.1.tar.gz", hash = "sha256:ce1851507218209961f89f3520e06726c0aa7d0512386f0f977e3ac3e4f2472e", size = 350784 } wheels = [ - { url = "https://files.pythonhosted.org/packages/e5/5a/d5474ca67a547dde9b87b5bc8a8f90eadf29f523d410f2ba23d63c9b82ec/openai-1.60.2-py3-none-any.whl", hash = "sha256:993bd11b96900b9098179c728026f016b4982ded7ee30dfcf4555eab1171fff9", size = 456107 }, + { url = "https://files.pythonhosted.org/packages/9a/b6/2e2a011b2dc27a6711376808b4cd8c922c476ea0f1420b39892117fa8563/openai-1.61.1-py3-none-any.whl", hash = "sha256:72b0826240ce26026ac2cd17951691f046e5be82ad122d20a8e1b30ca18bd11e", size = 463126 }, ] [[package]] @@ -4854,7 +4854,7 @@ requires-dist = [ { name = "numpy", marker = "python_full_version >= '3.12'", specifier = ">=1.26.0" }, { name = "ollama", marker = "extra == 'ollama'", specifier = "~=0.4" }, { name = "onnxruntime-genai", marker = "extra == 'onnx'", specifier = "~=0.5" }, - { name = "openai", specifier = "~=1.0" }, + { name = "openai", specifier = "~=1.61" }, { name = "openapi-core", specifier = ">=0.18,<0.20" }, { name = "opentelemetry-api", specifier = "~=1.24" }, { name = "opentelemetry-sdk", specifier = "~=1.24" }, From e12947ed5e70c820a9cb42415e7843e41715652d Mon Sep 17 00:00:00 2001 From: eavanvalkenburg Date: Wed, 12 Feb 2025 11:06:30 +0100 Subject: [PATCH 2/2] fixed tests --- .../ai/open_ai/services/test_azure_chat_completion.py | 1 - .../ai/open_ai/services/test_openai_chat_completion_base.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/python/tests/unit/connectors/ai/open_ai/services/test_azure_chat_completion.py b/python/tests/unit/connectors/ai/open_ai/services/test_azure_chat_completion.py index c512a38f1b10..1b7d0c13bafe 100644 --- a/python/tests/unit/connectors/ai/open_ai/services/test_azure_chat_completion.py +++ b/python/tests/unit/connectors/ai/open_ai/services/test_azure_chat_completion.py @@ -669,7 +669,6 @@ def test_tool(self, key: str): model=azure_openai_unit_test_env["AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"], stream=False, messages=azure_chat_completion._prepare_chat_history_for_request(orig_chat_history), - parallel_tool_calls=True, tools=[ { "type": "function", diff --git a/python/tests/unit/connectors/ai/open_ai/services/test_openai_chat_completion_base.py b/python/tests/unit/connectors/ai/open_ai/services/test_openai_chat_completion_base.py index c0b1000ae159..76de816fc65f 100644 --- a/python/tests/unit/connectors/ai/open_ai/services/test_openai_chat_completion_base.py +++ b/python/tests/unit/connectors/ai/open_ai/services/test_openai_chat_completion_base.py @@ -265,7 +265,6 @@ def test_tool(self, key: str): model=openai_unit_test_env["OPENAI_CHAT_MODEL_ID"], stream=False, messages=openai_chat_completion._prepare_chat_history_for_request(orig_chat_history), - parallel_tool_calls=True, tools=[ { "type": "function", @@ -757,7 +756,6 @@ def test_tool(self, key: str): mock_create.assert_awaited_once_with( model=openai_unit_test_env["OPENAI_CHAT_MODEL_ID"], stream=True, - parallel_tool_calls=True, tools=[ { "type": "function",