-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Accessing openai.ChatCompletion, no longer supported in openai>=1.0.0 - how to update the code to use the new API? (AZURE) #497
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
We don't plan to officially support Azure in this repo at the moment. But will leave this issue open for others to chime in. |
From my experience it's hard to make it work on Azure. Would someone be able to suggest how to make it work locally on ollama ? Is there a PR for ollama available that works? |
See #354 (comment) |
Does it mean no one else made this work recently on azure with openai new API |
@Marcelfoxion - i have just linked Azure on a fork this morning if you are still looking I can push it and share the link |
@ashsmith88 Yes pleas that would be awesome. Thank you! |
Hey @ashsmith88 is it this azure PR? here https://github.com/ashsmith88/screenshot-to-code/tree/main If you have a sec please let me know if this is what you was about to share. As I havent heard from you since. Cheers |
Apologies @Marcelfoxion - been really busy and forgot to reply! I have just pushed my (rather hacky) changes here: https://github.com/ashsmith88/screenshot-to-code/tree/quick-branch The branch works with Azure, but also has additional changes as I have got it to do a 2nd request with OpenAI to get the code in react which I can use as a template in my development - so you are probably only interested in some of the backend changes. From the Azure point of view, I added an env arg:
in config.py
The updated this function to look like this:
You will obviously need to make sure you have an Azure deployment and update anything above (i.e. I have hard coded my model as wasn't worried) This isn't a production ready fix at all, but works perfectly for me when using locally. |
I'm using Azure API keys.
The error in backend logs indicates that the [openai.ChatCompletion] API has been removed in [openai>=1.0.0].
You need to update your code to use the new API.
You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.
You can run
openai migrate
to automatically upgrade your codebase to use the 1.0.0 interface.Alternatively, you can pin your installation to the old version, e.g.
pip install openai==0.28
A detailed migration guide is available here: openai/openai-python#742
The text was updated successfully, but these errors were encountered: