You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue while using openai-python version 1.52.0. The error started occurring today, whereas the same code was working fine before. The error occurs in the following line in file src/openai/_models.py: if field_info.annotation and is_literal_type(field_info.annotation):
Error: AttributeError: 'ModelField' object has no attribute 'annotation'
To resolve this issue, I modified the code as follows:
if hasattr(field_info, 'annotation') and is_literal_type(field_info.annotation):
After this change, my service started working again as expected.
Key Concerns:
Possible Regression: The issue was not present in earlier versions but started occurring after openai-python 1.65.0 was released.
Backward Compatibility: Can you confirm if recent changes have introduced an incompatibility with older versions?
Priority Investigation: Since this issue affects previously stable versions, it could impact multiple users relying on openai-python.
To Reproduce
Using Python 3.9 and pydantic 1.9.0, run the following:
run = await self.client.beta.threads.runs.create_and_poll(
thread_id=thread_id,
assistant_id=assistant_id,
)
Describe the bug
I encountered an issue while using openai-python version 1.52.0. The error started occurring today, whereas the same code was working fine before. The error occurs in the following line in file src/openai/_models.py:
if field_info.annotation and is_literal_type(field_info.annotation):
Error:
AttributeError: 'ModelField' object has no attribute 'annotation'
To resolve this issue, I modified the code as follows:
if hasattr(field_info, 'annotation') and is_literal_type(field_info.annotation):
After this change, my service started working again as expected.
Key Concerns:
To Reproduce
Using Python 3.9 and pydantic 1.9.0, run the following:
run = await self.client.beta.threads.runs.create_and_poll(
thread_id=thread_id,
assistant_id=assistant_id,
)
messages = await self.client.beta.threads.messages.list(
thread_id=thread_id, run_id=run.id
)
Expected Behavior:
The code should execute successfully and return messages from the assistant's thread.
Actual Behavior:
The error AttributeError: 'ModelField' object has no attribute 'annotation' is raised.
Code snippets
OS
mac 15.3.1
Python version
3.9.0
Library version
1.52.0
The text was updated successfully, but these errors were encountered: