1
0
Fork 0

add openaihosted testing

This commit is contained in:
ezerinz 2023-04-28 16:36:53 +08:00
parent 8fe493a38a
commit f95ace3870
No known key found for this signature in database
GPG key ID: 8713BDED6DE33C4D

View file

@ -0,0 +1,14 @@
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}")