openai.ChatCompletion.create fails when nested

The python openai module is updated to .27 and I am able to write ChatCompletions just fine.

When my openai code is embedded in a function, it works fine.
When my openai code is embedded in a module, I get this error:
ERROR:root:module ‘openai’ has no attribute ‘ChatCompletion’
I have verified that my parameters are correct and they work just fine outside of a module.

Any pointers or ideas? The code is quite simple and doesn’t vary much from the example code.

I made the mistake of having a folder named openai.

A name collision was the whole issue.

2 Likes

Thanks for coming back to let us know. Hope you stick around.