freegpt-webui / g4f /.v1 /testing /openaihosted_test.py
monra's picture
Adds all providers from the original API
d4adf88
raw
history blame
443 Bytes
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}")