-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
33 lines (23 loc) · 832 Bytes
/
example.py
File metadata and controls
33 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import json
res = requests.post(
"https://engine.memori.ai/memori/v2/session",
json={"memoriId": "9b0a2913-d3d8-4e98-a49d-6e1c99479e1b"},
headers={"Content-Type": "application/json"}
)
response = res.json()
if response['resultCode'] != 0:
exit("Error: no session ID")
sessionID = response['sessionID']
if response['currentState']['emission']:
print("Nicola: " + response['currentState']['emission'])
while len(sessionID) > 0:
question = input("You: ")
res = requests.post(
"https://backend.memori.ai/memori/v2/TextEnteredEvent/" + sessionID,
json={"text": question},
headers={"Content-Type": "application/json"}
)
response = res.json()
if response['currentState']['emission']:
print("Nicola: " + response['currentState']['emission'])