Python: Bug: OpenAI Python issue on v1.99.7
Describe the bug Dependency bug: OpenAI Python package modified API on v1.99.7
SK does not pin a version of OpenAI and latest version of v1.99.7 (updated on 8/11/2025) removes the symbol ChatCompletionMessageToolCall in favor of ChatCompletionMessageToolCallUnion
https://github.com/openai/openai-python/commit/48085e2f473799d079e71d48d2f5612a6fbeb976
To Reproduce Steps to reproduce the behavior:
- Install SK, downloads latest OpenAI (v1.99.7)
- Bash command (assumes pip/venv ready with SK):
root@bb4f262afedd:/# python -c "import importlib.metadata as md, openai; print('openai version:', getattr(openai,'__version__', md.version('openai'))); from importlib import import_module as M; m=M('openai.types.chat.chat_completion_message_tool_call'); print('Has ChatCompletionMessageToolCall?', hasattr(m,'ChatCompletionMessageToolCall'))"
openai version: 1.99.7
Has ChatCompletionMessageToolCall? False
Can side-affect any semantic-kernel that has "openai >= 1.98.0" (as within semantic-kernel pyproject.toml).
root@bb4f262afedd:/# pipdeptree -p semantic-kernel | grep openai
├── openai [required: >=1.98.0, installed: 1.99.7]
Example error:
2025-08-11T19:03:05.508188630Z File "/usr/local/lib/python3.12/site-packages/semantic_kernel/connectors/ai/open_ai/__init__.py", line 39, in <module>
2025-08-11T19:03:05.508243884Z from semantic_kernel.connectors.ai.open_ai.services.azure_chat_completion import AzureChatCompletion
2025-08-11T19:03:05.508356865Z File "/usr/local/lib/python3.12/site-packages/semantic_kernel/connectors/ai/open_ai/services/azure_chat_completion.py", line 21, in <module>
2025-08-11T19:03:05.508466730Z from semantic_kernel.connectors.ai.open_ai.services.open_ai_chat_completion_base import OpenAIChatCompletionBase
2025-08-11T19:03:05.508471948Z File "/usr/local/lib/python3.12/site-packages/semantic_kernel/connectors/ai/open_ai/services/open_ai_chat_completion_base.py", line 17, in <module>
2025-08-11T19:03:05.508678254Z from openai.types.chat.chat_completion_message_tool_call import ChatCompletionMessageToolCall
2025-08-11T19:03:05.508687669Z ImportError: cannot import name 'ChatCompletionMessageToolCall' from 'openai.types.chat.chat_completion_message_tool_call' (/usr/local/lib/python3.12/site-packages/openai/types/chat/chat_completion_message_tool_call.py). Did you mean: 'ChatCompletionMessageToolCallUnion'?
Expected behavior OpenAI SDK API calls updated to fit latest version, or pin to revert previous 1.99.7
Platform
- Language: Python
- Source: SK 1.35.2
- AI model: n/a
- IDE: n/a
- OS: Docker (Linux/Mac)
Looks like OpenAI v1.99.8 is reverting the "ChatCompletionMessageToolCallUnion breaking change".
Thanks, @Keylan. Appreciate the link.
@richardjortega can you please upgrade to 1.99.8? It should fix the issue. All SK tests pass with this latest version.