summaryrefslogtreecommitdiffstats
path: root/testing/openaihosted_test.py
blob: d5a79e5209bcf234b7be7bc9aa4ad6fe2864f62f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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}")