-
Notifications
You must be signed in to change notification settings - Fork 3.9k
module openai
has no attribute resources
#2349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ah this was likely because of a change we made to make imports faster, for now you should be able to workaround this with |
Could you also share what you're using the |
We're hooking in to original_create = openai.resources.chat.Completions.create
def intercepted_create(_self: openai.resources.chat.Completions, **kwargs: Any) -> Any:
...
# Replace the original method with our intercepted version
openai.resources.chat.Completions.create = intercepted_create as well as type hinting completions: openai.resources.chat.Completions The former usage is a bit obscure, but the latter is common and surprising not to work in my opinion. Thanks for looking in to this. |
Can you try this?
|
Works! Thanks again. |
Just another use case: I have tests that monkeypatch |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
With the latest version 1.78.0,
openai.resources
no longer exists.Simply doing:
yields
AttributeError: module 'openai' has no attribute 'resources'
I use the
resources
to importopenai.resources.chat.Completions
In the previous version 1.77.0, this worked just fine. I am unsure if this intended behavior or a bug that slipped through. I'd appreciate your timely input!
To Reproduce
Code snippets
OS
macOS 15.3.1
Python version
Python 3.13.1
Library version
1.78.0
The text was updated successfully, but these errors were encountered: