mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-23 00:22:09 +03:00
add openaihosted testing
This commit is contained in:
parent
8fe493a38a
commit
f95ace3870
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 New Issue
Block a user