mirror of https://github.com/xtekky/gpt4free.git
|
||
---|---|---|
.. | ||
__init__.py | ||
readme.md |
readme.md
Example: openaihosted
(use like openai pypi package)
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}")