2023-04-29 12:25:24 +03:00
|
|
|
from gpt4free import you
|
2023-04-10 02:03:55 +03:00
|
|
|
|
|
|
|
# simple request with links and details
|
2023-04-26 21:20:18 +03:00
|
|
|
response = you.Completion.create(prompt="hello world", detailed=True, include_links=True)
|
2023-04-10 02:03:55 +03:00
|
|
|
|
|
|
|
print(response)
|
|
|
|
|
|
|
|
# {
|
|
|
|
# "response": "...",
|
|
|
|
# "links": [...],
|
|
|
|
# "extra": {...},
|
|
|
|
# "slots": {...}
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
|
2023-04-26 21:20:18 +03:00
|
|
|
# chatbot
|
2023-04-10 02:03:55 +03:00
|
|
|
|
|
|
|
chat = []
|
|
|
|
|
|
|
|
while True:
|
|
|
|
prompt = input("You: ")
|
2023-04-26 21:20:18 +03:00
|
|
|
|
|
|
|
response = you.Completion.create(prompt=prompt, chat=chat)
|
|
|
|
|
2023-04-29 12:25:24 +03:00
|
|
|
print("Bot:", response.text)
|
2023-04-26 21:20:18 +03:00
|
|
|
|
2023-04-29 12:25:24 +03:00
|
|
|
chat.append({"question": prompt, "answer": response.text})
|