Spaces:
Runtime error
Runtime error
File size: 579 Bytes
d3ebef2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import openai
openai.api_key = "####"
messages = []
system_msg = input("What type of chatbot would you like to create?\n")
messages.append({"role": "system", "content": system_msg})
print("Your new assistant is ready!")
while input != "quit()":
message = input()
messages.append({"role": "user", "content": message})
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=messages)
reply = response["choices"][0]["message"]["content"]
messages.append({"role": "assistant", "content": reply})
print("\n" + reply + "\n") |