-
Notifications
You must be signed in to change notification settings - Fork 807
Closed
Description
Which component is this bug for?
OpenAI Instrumentation
📜 Description
It looks like OpenAI has rearranged some types in its SDK, making some into Annotated[Union], which breaks some of our
isinstance
checks- imports
- tests
Opening this for visibility, details to come.
👟 Reproduction steps
- upgrade to latest
openai
:uv add -U openai
(version 1.99.7) - Run the code below
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument()
👍 Expected behavior
It instruments the code
👎 Actual Behavior with Screenshots
Traceback (most recent call last):
File "/Users/din/sandbox/py/openai_tool.py", line 8, in <module>
OpenAIInstrumentor().instrument()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/din/sandbox/py/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/instrumentor.py", line 125, in instrument
result = self._instrument( # pylint: disable=assignment-from-no-return
**kwargs
)
File "/Users/din/sandbox/py/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/openai/__init__.py", line 38, in _instrument
from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
File "/Users/din/sandbox/py/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/openai/v1/__init__.py", line 5, in <module>
from opentelemetry.instrumentation.openai.shared.chat_wrappers import (
...<2 lines>...
)
File "/Users/din/sandbox/py/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/openai/shared/chat_wrappers.py", line 53, in <module>
from openai.types.chat import ChatCompletionMessageToolCall
ImportError: cannot import name 'ChatCompletionMessageToolCall' from 'openai.types.chat' (/Users/din/sandbox/py/.venv/lib/python3.13/site-packages/openai/types/chat/__init__.py)
🤖 Python Version
3.13
📃 Provide any additional context for the Bug.
I think problems start since about 1.99.3
I might submit a PR after a bit more investigation, but since this is probably quite time-sensitive, I welcome anyone else to pick this up.
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
Metadata
Metadata
Assignees
Labels
No labels