Greg Thompson commited on
Commit
007ec3d
1 Parent(s): b4f5809

Added conversation_manager endpoint for programmatic message control

Browse files
app.py CHANGED
@@ -12,6 +12,7 @@ from mathtext.text2int import text2int
12
  from pydantic import BaseModel
13
 
14
  from mathtext_fastapi.nlu import prepare_message_data_for_logging
 
15
 
16
  app = FastAPI()
17
 
@@ -49,6 +50,16 @@ def text2int_ep(content: Text = None):
49
  return JSONResponse(content=content)
50
 
51
 
 
 
 
 
 
 
 
 
 
 
52
  @app.post("/nlu")
53
  async def evaluate_user_message_with_nlu_api(request: Request):
54
  """ Calls NLU APIs on the most recent user message from Turn.io message data and logs the message data
 
12
  from pydantic import BaseModel
13
 
14
  from mathtext_fastapi.nlu import prepare_message_data_for_logging
15
+ from mathtext_fastapi.conversation_manager import *
16
 
17
  app = FastAPI()
18
 
 
50
  return JSONResponse(content=content)
51
 
52
 
53
+ @app.post("/manager")
54
+ async def programmatic_message_manager(request: Request):
55
+ print(request)
56
+
57
+ data_dict = await request.json()
58
+ message_data = data_dict.get('message_data', '')
59
+
60
+ context = generate_message(message_data)
61
+ return JSONResponse(context)
62
+
63
  @app.post("/nlu")
64
  async def evaluate_user_message_with_nlu_api(request: Request):
65
  """ Calls NLU APIs on the most recent user message from Turn.io message data and logs the message data
mathtext_fastapi/conversation_manager.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import requests
4
+
5
+ from dotenv import load_dotenv
6
+
7
+ load_dotenv()
8
+
9
+ # os.environ.get('SUPABASE_URL')
10
+
11
+ def parse_data(data):
12
+ data_bytes = requests.body
13
+ data_decoded = data_bytes.decode()
14
+ data_json = json.loads(data_decoded)
15
+ return data_json
16
+
17
+ def generate_message(data_json):
18
+ """ pending
19
+
20
+ REQUIREMENTS
21
+ - implement logging of message
22
+ - have a very simple activity which allows for different dialogue
23
+ * add - Add the numbers, 1+1, 2+2
24
+ * subtract - Subtract the numbers, 1-1, 2-2
25
+ * menu - Choose one
26
+ - send message data to retrieve dialogue state
27
+ - retrieve response and build message object
28
+ - send message object
29
+
30
+ Need to make util functions that apply to both /nlu and /conversation_manager
31
+ """
32
+
33
+ # Intent Labelling #######################
34
+ # Call to Wit.ai for intent recognition
35
+
36
+ # message = data_json['messages'][0]['text']['body']
37
+ # formatted_message = message.replace(' ', '%20')
38
+
39
+ # Send a custom message with buttons
40
+ headers = {
41
+ 'Authorization': f"Bearer {os.environ.get('TURN_AUTHENTICATION_TOKEN')}",
42
+ 'Content-Type': 'application/json'
43
+ }
44
+ data = {
45
+ "to": data_json['message']['_vnd']['v1']['chat']['owner'],
46
+ # "to": "alan",
47
+ "type": "interactive",
48
+ "interactive": {
49
+ "type": "button",
50
+ # "header": { },
51
+ "body": {
52
+ "text": "Did I answer your question?"
53
+ },
54
+ # "footer": { },
55
+ "action": {
56
+ "buttons": [
57
+ {
58
+ "type": "reply",
59
+ "reply": {
60
+ "id": "inquiry-yes",
61
+ "title": "Yes"
62
+ }
63
+ },
64
+ {
65
+ "type": "reply",
66
+ "reply": {
67
+ "id": "inquiry-no",
68
+ "title": "No"
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ }
74
+ }
75
+
76
+ print("DATA=====================")
77
+ print(data)
78
+ print("=========================")
79
+
80
+ # r = requests.post(f'https://whatsapp.turn.io/v1/messages', data=json.dumps(data), headers=headers)
81
+
82
+ context = {"content":{"user":"Alan", "state": "received-and-replied-state"}}
83
+
84
+ return context
scripts/make_request.py CHANGED
@@ -1,133 +1,144 @@
1
  import requests
2
 
3
- request = requests.post(url=
4
- 'https://tangibleai-mathtext-fastapi.hf.space/sentiment-analysis',
5
- json={"content": "I reject it"}).json()
6
-
7
- print(request)
8
-
9
- request = requests.post(url=
10
- 'https://tangibleai-mathtext-fastapi.hf.space/text2int',
11
- json={"content": "seven thousand nine hundred fifty seven"}
12
- ).json()
13
-
14
- print(request)
15
-
16
-
17
- # json = {
18
- # 'message': {
19
- # '_vnd': {
20
- # 'v1': {
21
- # 'author': {
22
- # 'id': 57787919091,
23
- # 'name': 'GT',
24
- # 'type': 'OWNER'
25
- # },
26
- # 'card_uuid': None,
27
- # 'chat': {
28
- # 'assigned_to': {
29
- # 'id': 'jhk151kl-hj42-3752-3hjk-h4jk6hjkk2',
30
- # 'name': 'Greg Thompson',
31
- # 'type': 'OPERATOR'
32
- # },
33
- # 'contact_uuid': 'j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09',
34
- # 'inserted_at': '2022-07-05T04:00:34.033522Z',
35
- # 'owner': '+57787919091',
36
- # 'permalink': 'https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32',
37
- # 'state': 'OPEN',
38
- # 'state_reason': 'Re-opened by inbound message.',
39
- # 'unread_count': 19,
40
- # 'updated_at': '2023-01-10T02:37:28.487319Z',
41
- # 'uuid': '4kl209sd0-a7b8-2hj3-8563-3hu4a89b32'
42
- # },
43
- # 'direction': 'inbound',
44
- # 'faq_uuid': None,
45
- # 'in_reply_to': None,
46
- # 'inserted_at': '2023-01-10T02:37:28.477940Z',
47
- # 'labels': [{
48
- # 'confidence': 0.506479332,
49
- # 'metadata': {
50
- # 'nlu': {
51
- # 'confidence': 0.506479332,
52
- # 'intent': 'question',
53
- # 'model_name': 'nlu-general-spacy-ngrams-20191014'
54
- # }
55
- # },
56
- # 'uuid': 'ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds',
57
- # 'value': 'Unclassified'
58
- # }],
59
- # 'last_status': None,
60
- # 'last_status_timestamp': None,
61
- # 'on_fallback_channel': False,
62
- # 'rendered_content': None,
63
- # 'uuid': 's8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn'
64
- # }
65
- # },
66
- # 'from': 57787919091,
67
- # 'id': 'hsjkthzZGehkzs09sijWA3',
68
- # 'text': {'body': 'eight'},
69
- # 'timestamp': 1673318248,
70
- # 'type': 'text'
71
- # },
72
- # 'type': 'message'
73
- # }
74
-
75
- json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"eight"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
76
-
77
- # eight > 8
78
- request = requests.post(url=
79
- 'http://localhost:7860/nlu',
80
- data=json
81
- ).json()
82
- print(request)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- json2 = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"eight, nine, ten"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
85
 
86
- # "eight, nine, ten" > 8,9,10
87
- request = requests.post(url=
88
- 'http://localhost:7860/nlu',
89
- data=json2
90
- ).json()
91
-
92
- print(request)
93
-
94
-
95
- json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":8},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
96
-
97
- # 8 > 8
98
- request = requests.post(url=
99
- 'http://localhost:7860/nlu',
100
- data=json
101
- ).json()
102
-
103
- print(request)
104
-
105
- json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"8, 9, 10"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
106
-
107
- # "8, 9, 10" > "8,9,10"
108
- request = requests.post(url=
109
- 'http://localhost:7860/nlu',
110
- data=json
111
- ).json()
112
-
113
- print(request)
114
-
115
- json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"I dont know"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
116
-
117
- # "8, 9, 10" > "8,9,10"
118
- request = requests.post(url=
119
- 'http://localhost:7860/nlu',
120
- data=json
121
- ).json()
122
 
123
- print(request)
124
 
125
- json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"Today is a wonderful day"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
126
 
127
- # "8, 9, 10" > "8,9,10"
128
  request = requests.post(url=
129
- 'http://localhost:7860/nlu',
130
  data=json
131
  ).json()
132
-
133
  print(request)
 
1
  import requests
2
 
3
+ # request = requests.post(url=
4
+ # 'https://tangibleai-mathtext-fastapi.hf.space/sentiment-analysis',
5
+ # json={"content": "I reject it"}).json()
6
+
7
+ # print(request)
8
+
9
+ # request = requests.post(url=
10
+ # 'https://tangibleai-mathtext-fastapi.hf.space/text2int',
11
+ # json={"content": "seven thousand nine hundred fifty seven"}
12
+ # ).json()
13
+
14
+ # print(request)
15
+
16
+
17
+ # # json = {
18
+ # # 'message': {
19
+ # # '_vnd': {
20
+ # # 'v1': {
21
+ # # 'author': {
22
+ # # 'id': 57787919091,
23
+ # # 'name': 'GT',
24
+ # # 'type': 'OWNER'
25
+ # # },
26
+ # # 'card_uuid': None,
27
+ # # 'chat': {
28
+ # # 'assigned_to': {
29
+ # # 'id': 'jhk151kl-hj42-3752-3hjk-h4jk6hjkk2',
30
+ # # 'name': 'Greg Thompson',
31
+ # # 'type': 'OPERATOR'
32
+ # # },
33
+ # # 'contact_uuid': 'j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09',
34
+ # # 'inserted_at': '2022-07-05T04:00:34.033522Z',
35
+ # # 'owner': '+57787919091',
36
+ # # 'permalink': 'https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32',
37
+ # # 'state': 'OPEN',
38
+ # # 'state_reason': 'Re-opened by inbound message.',
39
+ # # 'unread_count': 19,
40
+ # # 'updated_at': '2023-01-10T02:37:28.487319Z',
41
+ # # 'uuid': '4kl209sd0-a7b8-2hj3-8563-3hu4a89b32'
42
+ # # },
43
+ # # 'direction': 'inbound',
44
+ # # 'faq_uuid': None,
45
+ # # 'in_reply_to': None,
46
+ # # 'inserted_at': '2023-01-10T02:37:28.477940Z',
47
+ # # 'labels': [{
48
+ # # 'confidence': 0.506479332,
49
+ # # 'metadata': {
50
+ # # 'nlu': {
51
+ # # 'confidence': 0.506479332,
52
+ # # 'intent': 'question',
53
+ # # 'model_name': 'nlu-general-spacy-ngrams-20191014'
54
+ # # }
55
+ # # },
56
+ # # 'uuid': 'ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds',
57
+ # # 'value': 'Unclassified'
58
+ # # }],
59
+ # # 'last_status': None,
60
+ # # 'last_status_timestamp': None,
61
+ # # 'on_fallback_channel': False,
62
+ # # 'rendered_content': None,
63
+ # # 'uuid': 's8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn'
64
+ # # }
65
+ # # },
66
+ # # 'from': 57787919091,
67
+ # # 'id': 'hsjkthzZGehkzs09sijWA3',
68
+ # # 'text': {'body': 'eight'},
69
+ # # 'timestamp': 1673318248,
70
+ # # 'type': 'text'
71
+ # # },
72
+ # # 'type': 'message'
73
+ # # }
74
+
75
+ # json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"eight"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
76
+
77
+ # # eight > 8
78
+ # request = requests.post(url=
79
+ # 'http://localhost:7860/nlu',
80
+ # data=json
81
+ # ).json()
82
+ # print(request)
83
+
84
+ # json2 = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"eight, nine, ten"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
85
+
86
+ # # "eight, nine, ten" > 8,9,10
87
+ # request = requests.post(url=
88
+ # 'http://localhost:7860/nlu',
89
+ # data=json2
90
+ # ).json()
91
+
92
+ # print(request)
93
+
94
+
95
+ # json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":8},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
96
+
97
+ # # 8 > 8
98
+ # request = requests.post(url=
99
+ # 'http://localhost:7860/nlu',
100
+ # data=json
101
+ # ).json()
102
+
103
+ # print(request)
104
+
105
+ # json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"8, 9, 10"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
106
+
107
+ # # "8, 9, 10" > "8,9,10"
108
+ # request = requests.post(url=
109
+ # 'http://localhost:7860/nlu',
110
+ # data=json
111
+ # ).json()
112
+
113
+ # print(request)
114
+
115
+ # json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"I dont know"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
116
+
117
+ # # "8, 9, 10" > "8,9,10"
118
+ # request = requests.post(url=
119
+ # 'http://localhost:7860/nlu',
120
+ # data=json
121
+ # ).json()
122
+
123
+ # print(request)
124
+
125
+ # json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"Today is a wonderful day"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
126
+
127
+ # # "8, 9, 10" > "8,9,10"
128
+ # request = requests.post(url=
129
+ # 'http://localhost:7860/nlu',
130
+ # data=json
131
+ # ).json()
132
+
133
+ # print(request)
134
 
 
135
 
136
+ json = b'{"message_data": {"message":{"_vnd":{"v1":{"author":{"id":57787919091,"name":"GT","type":"OWNER"},"card_uuid":null,"chat":{"assigned_to":{"id":"jhk151kl-hj42-3752-3hjk-h4jk6hjkk2","name":"Greg Thompson","type":"OPERATOR"},"contact_uuid":"j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09","inserted_at":"2022-07-05T04:00:34.033522Z","owner":"+57787919091","permalink":"https://app.turn.io/c/4kl209sd0-a7b8-2hj3-8563-3hu4a89b32","state":"OPEN","state_reason":"Re-opened by inbound message.","unread_count":14,"updated_at":"2023-01-10T02:37:28.487319Z","uuid":"4kl209sd0-a7b8-2hj3-8563-3hu4a89b32"},"direction":"inbound","faq_uuid":null,"in_reply_to":null,"inserted_at":"2023-01-10T02:37:28.477940Z","labels":[{"confidence":0.506479332,"metadata":{"nlu":{"confidence":0.506479332,"intent":"question","model_name":"nlu-general-spacy-ngrams-20191014"}},"uuid":"ha7890s2k-hjk2-2476-s8d9-fh9779a8a9ds","value":"Unclassified"}],"last_status":null,"last_status_timestamp":null,"on_fallback_channel":false,"rendered_content":null,"uuid":"s8df79zhws-h89s-hj23-7s8d-thb248d9bh2qn"}},"from":57787919091,"id":"hsjkthzZGehkzs09sijWA3","text":{"body":"Today is a wonderful day"},"timestamp":1673318248,"type":"text"},"type":"message"}}\n'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
 
138
 
 
139
 
 
140
  request = requests.post(url=
141
+ 'http://localhost:7860/manager',
142
  data=json
143
  ).json()
 
144
  print(request)