1
0
Fork 0
GPT4FREE/testing/openaihosted_test.py

15 lines
443 B
Python
Raw Normal View History

2023-04-28 08:36:53 +00:00
import openaihosted
messages = [{"role": "system", "content": "You are a helpful assistant."}]
while True:
question = input("Question: ")
if question == "!stop":
break
messages.append({"role": "user", "content": question})
request = openaihosted.Completion.create(messages=messages)
response = request["responses"]
messages.append({"role": "assistant", "content": response})
print(f"Answer: {response}")