1
0
Fork 0
GPT4FREE/openaihosted
2023-04-28 16:37:28 +08:00
..
__init__.py openaihosted finished 2023-04-27 16:05:06 -07:00
readme.md update readme/usage example 2023-04-28 16:37:28 +08:00

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}")