-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
After updating openai via conda i got the above error message:
ImportError: cannot import name ‘ThreadMessage’ from ‘openai.types.beta.threads’
It is also reported here:
After trying to find the bug, i think it is related to a wrong import statement in:
\Lib\site-packages\openai\resources\beta\threads\messages\messages.py
were for example in the case of message_list_params the module is imported from :
\Lib\site-packages\openai\types\beta\threads\message_list_params.py
There is however no module in:
\Lib\site-packages\openai\types\beta\threads\ThreadMessage.py
instead there is the module
\Lib\site-packages\openai\types\beta\threads\thread_message.py
which contains the class ThreadMessage.
Either the import in \Lib\site-packages\openai\resources\beta\threads\messages\messages.py is changed to :
#from .....types.beta.threads import ThreadMessage, message_list_params, message_create_params, message_update_params
from .....types.beta.threads import message_list_params, message_create_params, message_update_params
from .....types.beta.threads.thread_message import ThreadMessage
or which would be more consistent, the import is changed to:
from .....types.beta.threads import thread_message, message_list_params, message_create_params, message_update_params
and every occurance of:
ThreadMessage
in the code is changed to
thread_message.ThreadMessage
To Reproduce
update to newest openai version via conda and use:
from openai import AzureOpenAI
Code snippets
No response
OS
windows
Python version
3.10
Library version
1.13.3