Fix deprecated OpenAI v0 API and add requirements.txt#3
Open
rafaym1 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
run_bfi.pyandrun_creative_writing.pyuseopenai.ChatCompletion.create()which was removed inopenai>=1.0.0(Nov 2023). Anyone installing the package today gets v1.x and hits anAttributeErrorimmediately.Also adds a missing
requirements.txtand updates the README setup instructions (the referencedaudiencenlpconda environment was not included in the repo).Changes
run_bfi.py/run_creative_writing.py: migrate toopenai>=1.0.0client APIimport openai→from openai import OpenAIopenai.api_key = ""/openai.organization = ""openai.ChatCompletion.create()→client.chat.completions.create()response["choices"][0]["message"]["content"]→response.choices[0].message.contentOPENAI_API_KEYenvironment variablerequirements.txt: added (was missing entirely)README.md: replacedconda activate audiencenlpwithpip install -r requirements.txtand env var setup instructions