add openaihosted testing
This commit is contained in:
parent
8fe493a38a
commit
f95ace3870
1 changed files with 14 additions and 0 deletions
14
testing/openaihosted_test.py
Normal file
14
testing/openaihosted_test.py
Normal 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}")
|
Loading…
Reference in a new issue