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
Data science student here trying to create different projects in order to get more experince in my resume, but having some trouble with making my chatbot that uses chat GPT. I tried reading the readme file I was directed to, but being a beginner with AI, I was quickly overwhelmed and didn't know what to do. Can someone help me please?
The code is:
import openai
openai.api_key = 'sk....'
while True:
user_input = input("You: ")
if user_input.lower() in ["quit", "exit", "bye"]:
print("Chatbot: Goodbye!")
break
response = chat_with_gpt(user_input)
print(f"Chatbot: {response}")
The error I receive is:
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: #742
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Data science student here trying to create different projects in order to get more experince in my resume, but having some trouble with making my chatbot that uses chat GPT. I tried reading the readme file I was directed to, but being a beginner with AI, I was quickly overwhelmed and didn't know what to do. Can someone help me please?
The code is:
import openai
openai.api_key = 'sk....'
def chat_with_gpt(prompt):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo", # or "gpt-4"
messages=[{"role": "user", "content": prompt}]
)
return response['choices'][0]['message']['content'].strip()
while True:
user_input = input("You: ")
if user_input.lower() in ["quit", "exit", "bye"]:
print("Chatbot: Goodbye!")
break
response = chat_with_gpt(user_input)
print(f"Chatbot: {response}")
The error I receive is:
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: #742
Beta Was this translation helpful? Give feedback.
All reactions