2023-04-09 23:03:55 +00:00
|
|
|
import you
|
|
|
|
|
|
|
|
# simple request with links and details
|
|
|
|
response = you.Completion.create(
|
|
|
|
prompt = "hello world",
|
|
|
|
detailed = True,
|
2023-04-25 17:40:17 +00:00
|
|
|
includelinks = True)
|
2023-04-09 23:03:55 +00:00
|
|
|
|
|
|
|
print(response)
|
|
|
|
|
|
|
|
# {
|
|
|
|
# "response": "...",
|
|
|
|
# "links": [...],
|
|
|
|
# "extra": {...},
|
|
|
|
# "slots": {...}
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
|
|
|
|
#chatbot
|
|
|
|
|
|
|
|
chat = []
|
|
|
|
|
|
|
|
while True:
|
|
|
|
prompt = input("You: ")
|
|
|
|
|
|
|
|
response = you.Completion.create(
|
|
|
|
prompt = prompt,
|
|
|
|
chat = chat)
|
|
|
|
|
|
|
|
print("Bot:", response["response"])
|
|
|
|
|
|
|
|
chat.append({"question": prompt, "answer": response["response"]})
|