runsdata commited on
Commit
4858f73
·
1 Parent(s): 176502d

Initial commit

Browse files
app.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import csv
4
+ import shutil
5
+ from datetime import datetime
6
+ import openai
7
+ import gradio as gr
8
+ import pandas
9
+
10
+ # Embeddings
11
+ from langchain.embeddings.openai import OpenAIEmbeddings
12
+ from langchain.vectorstores import Chroma
13
+
14
+ # Chat Q&A
15
+ from langchain.chat_models import ChatOpenAI
16
+ from langchain.schema import AIMessage, HumanMessage, SystemMessage
17
+
18
+ # This sets up OpenAI embeddings model
19
+ embeddings = OpenAIEmbeddings()
20
+
21
+ # Loads database from persisted directory
22
+ db_directory = "/docs/2023_12_06_chroma_db"
23
+ db = Chroma(persist_directory=db_directory, embedding_function=embeddings)
24
+
25
+ # This is code that retrieves relevant documents based on a similarity search (in this case, it grabs the top 2 relevant documents or chunks)
26
+ retriever = db.as_retriever(search_type='similarity', search_kwargs={"k":2})
27
+
28
+ with open('system_prompt.txt', 'r') as file:
29
+ ORIG_SYSTEM_MESSAGE_PROMPT = file.read()
30
+
31
+ openai.api_key = os.getenv("OPENAI_API_KEY")
32
+
33
+ #chat = ChatOpenAI(model_name="gpt-3.5-turbo",temperature=0) # Faster for experiments
34
+ chat = ChatOpenAI(model_name="gpt-4",temperature=0)
35
+
36
+ # Make sure we don't exceed estimation of token limit:
37
+ TOKEN_LIMIT = 4096 # GPT-3.5 Turbo token limit
38
+ BUFFER = 100 # Extra tokens to consider for incoming messages
39
+ PERSISTENT_LOG_PATH = "/data/downvoted_responses.csv" # File in which to log downvoted responses
40
+ LOCAL_LOG_PATH = "./data/downvoted_responses.csv"
41
+
42
+ def estimate_tokens(texts):
43
+ return sum([len(t.split()) for t in texts])
44
+
45
+ def truncate_history(history):
46
+ tokens = estimate_tokens([msg.content for msg in history])
47
+ while tokens + BUFFER > TOKEN_LIMIT and len(history) > 3:
48
+ history = history[0:1] + history[3:]
49
+ tokens = estimate_tokens([msg.content for msg in history])
50
+ return history
51
+
52
+ def get_full_context(input):
53
+ retrieved_documents = retriever.get_relevant_documents(input)
54
+ context = "" # Initialize an empty string
55
+
56
+ file_path = "/docs/Troubleshooting_Table.csv"
57
+ data = pd.read_csv(file_path)
58
+ for doc in retrieved_documents:
59
+ index = doc.metadata['index']
60
+ context += str(data.iloc[[index]])
61
+
62
+ return context
63
+
64
+
65
+ is_first_run = True # Flag to check if it's the first run
66
+
67
+ # Here is the langchain
68
+ def predict(history, input):
69
+
70
+ global is_first_run # Use the global flag
71
+ if is_first_run:
72
+ context = get_full_context(input)
73
+ print(context) # For debugging
74
+ is_first_run = False # Set the flag to False after the first run
75
+ else:
76
+ context = ""
77
+
78
+ history_langchain_format = []
79
+ history_langchain_format.append(SystemMessage(content=f"{ORIG_SYSTEM_MESSAGE_PROMPT}, here is the user information: {user_info_simulated}"))
80
+ for human, ai in history:
81
+ history_langchain_format.append(HumanMessage(content=human))
82
+ history_langchain_format.append(AIMessage(content=ai))
83
+ history_langchain_format.append(HumanMessage(content=input))
84
+ history_langchain_format.append(SystemMessage(content=f"Here is a table with some potentially useful information for troubleshooting: {context}"))
85
+
86
+ # Truncate if history is too long
87
+ history_langchain_format = truncate_history(history_langchain_format)
88
+
89
+ gpt_response = chat(history_langchain_format)
90
+
91
+ # Extract pairs of HumanMessage and AIMessage
92
+ pairs = []
93
+ for i in range(len(history_langchain_format)):
94
+ if isinstance(history_langchain_format[i], HumanMessage) and (i+1 < len(history_langchain_format)) and isinstance(history_langchain_format[i+1], AIMessage):
95
+ pairs.append((history_langchain_format[i].content, history_langchain_format[i+1].content))
96
+
97
+ # Add the new AI response to the pairs for subsequent interactions
98
+ pairs.append((input, gpt_response.content))
99
+
100
+ return pairs
101
+
102
+ # Function to handle user message (this clears the interface)
103
+ def user(user_message, chatbot_history):
104
+ return "", chatbot_history + [[user_message, ""]]
105
+
106
+ # Function to handle AI's response
107
+ def bot(chatbot_history):
108
+ user_message = chatbot_history[-1][0] #This line is because we cleared the user_message previously in the user function above
109
+ # Call the predict function to get the AI's response
110
+ pairs = predict(chatbot_history, user_message)
111
+ _, ai_response = pairs[-1] # Get the latest response
112
+
113
+ response_in_progress = ""
114
+ for character in ai_response:
115
+ response_in_progress += character
116
+ chatbot_history[-1][1] = response_in_progress
117
+ time.sleep(0.05)
118
+ yield chatbot_history
119
+
120
+ def log_to_csv(question, answer):
121
+ """Append a line to a CSV. Create a new file if needed."""
122
+ now = datetime.today().strftime("%Y%m%d_%H:%M:%S")
123
+ if not os.path.isfile(PERSISTENT_LOG_PATH):
124
+ # Add the column names to the CSV
125
+ with open(PERSISTENT_LOG_PATH, "w+") as csv_file:
126
+ writer = csv.writer(csv_file)
127
+ writer.writerow(["datetime", "user_question", "bot_response"])
128
+
129
+ # Write the disliked message to the CSV
130
+ with open(PERSISTENT_LOG_PATH, "a") as csv_file:
131
+ writer = csv.writer(csv_file)
132
+ writer.writerow([now, question, answer])
133
+
134
+ # Copy file from persistent storage to local repo
135
+ shutil.copyfile(PERSISTENT_LOG_PATH, LOCAL_LOG_PATH)
136
+
137
+ def get_voted_qa_pair(history, voted_answer):
138
+ """Return the question-answer pair from the chat history, given a
139
+ particular bot answer. Note: This is required because the 'vote'
140
+ event handler only has access to the answer that was liked/disliked.
141
+ """
142
+ for question, answer in history:
143
+ if answer == voted_answer:
144
+ return question, answer
145
+
146
+ def vote(data: gr.LikeData, history):
147
+ """This is a function to do something with the voted information"""
148
+ print(history)
149
+ if data.liked:
150
+ print("You upvoted this response: " + data.value)
151
+ else:
152
+ print("You downvoted this response: " + data.value)
153
+ # Find Q/A pair that was disliked
154
+ question, answer = get_voted_qa_pair(history, data.value)
155
+ log_to_csv(question, answer)
156
+
157
+ def reset_flag():
158
+ global is_first_run
159
+ is_first_run = True
160
+
161
+ # The Gradio App interface
162
+ with gr.Blocks() as demo:
163
+ gr.Markdown("""<h1><center>DylanAI by CIONIC</center></h1>""")
164
+ gr.Markdown("""<p><center>For best results, please ask DylanAI one question at a time. Unlike Human Dylan, DylanAI cannot multitask.</center></p>""")
165
+ chatbot = gr.Chatbot(label="DylanAI")
166
+ textbox = gr.Textbox(label="Type your question here")
167
+ clear_button = gr.ClearButton(components=[chatbot])
168
+ clear_button.click(reset_flag, None, None)
169
+
170
+ # Chain user and bot functions with `.then()`
171
+ textbox.submit(user, [textbox, chatbot], [textbox, chatbot], queue=False).then(
172
+ bot, chatbot, chatbot,
173
+ )
174
+ chatbot.like(vote, chatbot, None)
175
+
176
+ # Enable queuing
177
+ demo.queue()
178
+ demo.launch(debug=True, share=True)
179
+
180
+
docs/.DS_Store ADDED
Binary file (6.15 kB). View file
 
docs/2023_12_05_chroma_db_v2/02adf51d-efcc-4c3c-a866-2bede598855a/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f18abd8c514282db82706e52b0a33ed659cd534e925a6f149deb7af9ce34bd8e
3
+ size 6284000
docs/2023_12_05_chroma_db_v2/02adf51d-efcc-4c3c-a866-2bede598855a/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:effaa959ce2b30070fdafc2fe82096fc46e4ee7561b75920dd3ce43d09679b21
3
+ size 100
docs/2023_12_05_chroma_db_v2/02adf51d-efcc-4c3c-a866-2bede598855a/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d2a767b41f7386b467051f0f9d5709b98c6234d5385b741ddcb3496f9fa98fb
3
+ size 4000
docs/2023_12_05_chroma_db_v2/02adf51d-efcc-4c3c-a866-2bede598855a/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
docs/2023_12_05_chroma_db_v2/chroma.sqlite3 ADDED
Binary file (815 kB). View file
 
docs/Troubleshooting_Table.csv ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Symptoms,Core Issue,Steps to Solve,Related Issues,Escalation,Images
2
+ Device is not compatible,App-compatible devices,"Confirm the user is using one of the following compatible devices:
3
+ iPhone: iPhone 11 and newer (recommended); iOS 15.x or later.
4
+ iPad: iPad (7th generation) or newer, iPad Pro (4th generation) or newer, iPad Air (4th generation) or newer, iPad Mini (6th generation) or newer; iPadOS 15.x or later.
5
+ Android: recommended device info TBD; Android 10 (API 29) or later.",None,Escalate if user's device is not on the compatibility list and no alternative compatible device is available.,
6
+ "Font is too big, font is too small",,Change font size in phone settings,Some expected visual elements missing on some screens due to large font sizes.,Escalate if changing font size does not resolve the issue or if it causes functionality problems in the app.,
7
+ "Issues with camera or audio, camera won't flip, camera won't swap, cannot hear technician",Software issues- tech portal,"Camera:
8
+ Turn on phone camera
9
+ Disconnect and then reconnect in the portal
10
+
11
+ User cannot hear technician:
12
+ Turn on speaker","Device is not compatible, Bluetooth pairing/connection issues",Escalate if basic troubleshooting (like restarting device or checking settings) fails.,
13
+ "Not able to find Control Unit (range issue or Control Unit is not powered on) Connections repeatedly fail (Control Unit is paired to another phone) Able to connect, but seeing a “--” for battery level in the app’s hub side menu (pairing issue) Seeing “Encryption is insufficient” in the app log from a reported issue (pairing issue)",Bluetooth pairing/connection issues,"Things to check:
14
+ Check Control Unit distance from phone - must be near phone (< 20 ft)
15
+ Check that airplane mode on the phone is turned off and that Bluetooth is turned on
16
+ Verify that the phone and Control Unit have sufficient battery levels
17
+ Remove phone case, if any
18
+ Things to try:
19
+ Restart Control Unit from hub side menu and/or power cycle Control Unit
20
+ Move to a different location. Other electronic devices that use the 2.4GHz frequency band can cause interference and impact the performance of BLE devices.
21
+ Turn Bluetooth off/on on phone
22
+ Force quit/restart app
23
+ Power cycle phone
24
+ Try to connect from a different phone/tablet Note: If the user is switching phones, need to unpair/factory reset from the old phone before it can be paired with the new phone","Issues changing parameters, Sleeve keeps getting unplugged.",Escalate if all troubleshooting steps fail to establish a connection.,
25
+ "Cannot connect to control unit after previous slow/incomplete disconnection, Cannot connect to control unit after backgrounding the app
26
+ ",Bluetooth pairing/connection issues,Force quit + restart app. Phone reboot may also be required.,"Not able to find Control Unit (range issue or Control Unit is not powered on), Battery not charging, battery not charging enough, poor charging",Escalate if force quitting and restarting the app or rebooting the phone does not resolve the issue.,
27
+ "Plug control unit into the sleeve, don't see 3 flashing green lights that indicate a proper connection",Sleeve cable issues,"1.Instruct user to put Control Unit in the pocket first and then plug in the connector/cable; make sure that the DC is in the pocket
28
+ 2. Visually check for proper insertion of the sleeve connector
29
+ 3. Make sure user knows to press in side buttons before removing cable
30
+ 4. Verify that the LED on the Control Unit flashes green 3x after plugging in the cable (this is different from “breathing green” when the Control Unit is powered on while adequately charged)
31
+ 5. If 3x green LED flashes are not seen, try restarting the Control Unit from the app's hub side menu and/or power cycle the Control Unit by long-pressing the button until the LED goes off (about 3 seconds), then pressing the button again to turn it back on. Then reattempt cable insertion.","Errors when upgrading sleeve, errors when upgrading control unit, Firmware upgrade issues","Escalate if repeated attempts at reconnection, including restarting the Control Unit, fail.",
32
+ Sleeve keeps getting unplugged,Sleeve cable issues,"Instruct user to put Control Unit in the pocket first and then plug in the connector/cable; make sure that the DC is in the pocket
33
+ Visually check for proper insertion of the sleeve connector
34
+ Make sure user knows to press in side buttons before removing cable
35
+ Verify that the LED on the Control Unit flashes green 3x after plugging in the cable (this is different from “breathing green” when the Control Unit is powered on while adequately charged)
36
+ If 3x green LED flashes are not seen, try restarting the Control Unit from the app's hub side menu and/or power cycle the Control Unit by long-pressing the button until the LED goes off (about 3 seconds), then pressing the button again to turn it back on. Then reattempt cable insertion.","Plug control unit into the sleeve, don't see 3 flashing green lights that indicate a proper connection, Notification of weak signal from electrodes, impedance check errors",Escalate if issue persists after ensuring proper insertion and restarting the Control Unit.,
37
+ "Notification of weak signal from electrodes, impedance check errors",Impedance check error,"Pat down electrodes
38
+ When was the last time they changed their electrodes?","Stuck in electrode calibration phase, failed impedance check, Gel electrodes falling off/ won't adhere to the skin",Escalate if patting down electrodes and changing them does not solve the problem.,
39
+ "Stuck in electrode calibration phase, failed impedance check",Impedance check error,,"Loss of stimulation, Stimulation with the wrong timing",Escalate if recalibration attempts fail consistently.,
40
+ Loss of stimulation,Stim issues; gel electrode issues,"Verify electrodes placement on body (especially for TA)
41
+ Verify the settings in the FES configuration and the slider in the capp screen
42
+ Replace electrodes
43
+ Possible muscle fatigue","Stimulation errors, Battery not charging, battery not charging enough, poor charging",Escalate if verifying settings and electrode placement does not restore functionality.,
44
+ Stimulation with the wrong timing,Stim issues; gel electrode issues,"Prompt the user to recalibrate properly, and see if the problem disappears. ","Stimulation errors, Skeleton on app looks odd",Escalate if recalibration does not correct the timing issue.,
45
+ Stimulation errors,Stim issues; gel electrode issues,"Prompt the user to recalibrate properly, and see if the problem disappears. ","Battery not charging, battery not charging enough, poor charging, Errors when upgrading sleeve, errors when upgrading control unit",Escalate if recalibration does not resolve the errors.,
46
+ "Battery not charging, battery not charging enough, poor charging",Battery issues,"The battery needs a high power charger for adequate charging. The user must use the cable and charger that is provided for charging their device (""Charger has limited power to charge"" notification may be seen otherwise). Failure to do so will result in poor charging.","Cannot connect to control unit after previous slow/incomplete disconnection, Cannot connect to control unit after backgrounding the app, Device is not compatible",Escalate if using the correct charger and cable does not solve the charging issue.,
47
+ "Errors when upgrading sleeve, errors when upgrading control unit",Firmware upgrade issues,Ask user for code/error message,"Firmware upgrade issues, Plug control unit into the sleeve, don't see 3 flashing green lights that indicate a proper connection",Escalate if error codes persist after asking the user for specific messages and attempting basic troubleshooting.,
48
+ Gel electrodes falling off/ won't adhere to the skin,Gel electrode issues,"Make sure skin is clean of any lotions/oils
49
+ Recommend moisturizing overnight so skin is not dry
50
+ Trim any extra leg hair
51
+ Change gel electrode pads
52
+ Slippage in hot weather (sweat)
53
+ Dry skin
54
+ Replace gel electrodes
55
+ ","Notification of weak signal from electrodes, impedance check errors, Skin irritation",Escalate if skin preparation and electrode replacement do not fix the issue.,
56
+ Difficulty placing electrodes,,Palpating TA (try on unaffected leg first),"Stuck in electrode calibration phase, failed impedance check, Gel electrodes falling off/ won't adhere to the skin",Escalate if palpation techniques do not aid in correct placement.,
57
+ Skin irritation,,"(redness persisting more than a few hours, skin breakdown, burn)
58
+ If redness, contact us
59
+ If a burn, discontinue use and contact
60
+ If open skin, discontinue use and contact","Gel electrodes falling off/ won't adhere to the skin, Residue of goopy balls on skin",Immediate escalation for burns or open skin; escalate for persistent redness.,
61
+ Residue of goopy balls on skin,,"Use a cloth to clean skin when removing the sleeve, Use the back of the gel pad to blot at fabric to pick up any gel residue","Skin irritation, Gel electrodes falling off/ won't adhere to the skin",No escalation,
62
+ Velcro coming undone,,"Check electrode connection
63
+ Sleeve is indicated for gait, not other movements",,Escalate if checking connections and ensuring correct usage does not solve the problem.,
64
+ Skeleton on app looks odd,,"Prompt the user to recalibrate properly, and see if the problem disappears.","Stimulation with the wrong timing, Stimulation errors",Escalate if recalibration does not correct the display issue.,
65
+ Issues changing parameters,,"Neuropathy–try adjusting frequency to determine if higher or lower frequencies improve sensitivity. Contact Cionic if neuropathy increases
66
+ Initial sensation uncomfortable–instruct customer in getting past the sensory level to the motor level which is often more comfortable","Not able to find Control Unit (range issue or Control Unit is not powered on), Battery not charging, battery not charging enough, poor charging",Escalate if adjusting frequencies and guidance on sensory to motor level transition do not work.,
67
+ Login issues,,"Is an account created on cionic.com (same one as signed up with)?
68
+ Invalid credentials
69
+ Needs new email for log in
70
+ Email deliverability issues
71
+ Create individual login and send separate email","Device is not compatible, Some expected visual elements missing on some screens due to large font sizes",Escalate if account verification and troubleshooting email issues do not resolve the problem.,
72
+ Some expected visual elements (ex: buttons) are missing on some screens due to large font sizes,,"Ask user to reduce system or accessibility font sizes
73
+ Do they have a Galaxy Fold? If yes, please use the front cover screen which is similar to a normal phone screen and does not hide buttons","Font is too big, font is too small, Device is not compatible",Escalate if adjusting font sizes or using alternative displays (like front cover screen on Galaxy Fold) does not resolve the issue.,
74
+ "No steps recorded in the app, incorrect number of steps recorded in app",,"Bring app out of the background to reconnect
75
+ Powering off the Control Unit (long press on Control Unit button) stops stimulation and ends a protocol, but because of this, steps cannot be fetched
76
+ Short-press can stop stimulation and then go into the app to stop a protocol
77
+ Control Unit ran out of battery before the program was stopped
78
+ BLE disconnect just before the recording stopped, steps could not be fetched
79
+ Make sure not to stop a program with BLE disconnected","Cannot connect to control unit after previous slow/incomplete disconnection, Cannot connect to control unit after backgrounding the app"", Bluetooth pairing/connection issues",Escalate if ensuring proper app usage and troubleshooting connectivity issues do not correct the step count.,
80
+ Issue with reporting an issue,,"Ensure that the Control Unit is Bluetooth-connected to the app
81
+ Make sure that you have a good network connection (WiFi recommended) before submitting issues","Login issues, Device is not compatible",Escalate if ensuring proper network connection and Bluetooth connectivity does not allow issue submission.,
82
+ "100
83
+ ALERT_NOCARD
84
+
85
+
86
+ ",missing sd card,,,,
87
+ "101
88
+ ALERT_CHARGED
89
+ ",battery charged,,,,
90
+ "102
91
+ ALERT_CHARGING
92
+ ",battery charging,"The battery needs a high power charger for adequate charging. The user must use the cable and charger that is provided for charging their device (""Charger has limited power to charge"" notification may be seen otherwise). Failure to do so will result in poor charging.",,,
93
+ "103
94
+ ALERT_NOMUSCLE
95
+ ",no muscle,,,,
96
+ "104
97
+ ALERT_STIM_LL
98
+ ",stim low level error,,,,
99
+ "105
100
+ ALERT_STIM_BUF
101
+ ",stim buffer error,,,,
102
+ "106
103
+ ALERT_STIM_PW
104
+ ",stim pulse width out of bounds,,,,
105
+ "107
106
+ ALERT_STIM_DAC",stim intensity out of bounds,,,,
107
+ "108
108
+ ALERT_STIM_TIM",stim timer error,,,,
109
+ "109
110
+ ALERT_STIM_CRC",stim crc error,Check cable connections,,,
111
+ "110
112
+ ALERT_STIM_MUSCLE",stim mux configuration invalid,,,,
113
+ "111 (old FW) or 149 + channel (150-159)
114
+ ALERT_STIM_MAX",stim above maximum load threshold,check electrodes,,,
115
+ "112
116
+ ALERT_STIM_FREQ
117
+
118
+ ",stim frequency out of bounds,,,,
119
+ "113 (old FW) or 159 + channel (160-169)
120
+ ALERT_STIM_MIN",stim below minimum load threshold,check electrodes,,,
121
+ "114
122
+ ALERT_STIM_GENERIC
123
+
124
+ ",stim error generic,,,,
125
+ "115 (old FW) or 169 + channel (170-179)
126
+ ALERT_STIM_TIMEOUT",single muscle stimulated for more than 5 seconds,,,,
127
+ "116
128
+ ALERT_STIM_CURRENT
129
+ ",stim current out of boounds,,,,
130
+ "117
131
+ ALERT_STIM_SAFETY
132
+ ",stim is in safety mode,,,,
133
+ "118 (old FW) or 179 + channel (180-189)
134
+ ALERT_STIM_ELECTRODE",one or more electrodes detached,check electrodes,,,
135
+ "119
136
+ ALERT_SELF_TEST
137
+ ",FES hardware issue,,,,
138
+ "120
139
+ ALERT_BAD_CHARGER
140
+ ",charger cannot provide enough power to charge DC,,,,
141
+ "121
142
+ ALERT_ELECTRODE_TEST",FES electrode hardware issue,,,,
143
+ FES hardware fault code c0,,"Restart the app and try again. If error persists, escalate immediately to CIONIC support",,,
144
+ internalError = 99,should never happen,Immediately escalate,,,
145
+ currentVersionsUnavailable = 100,Deprecated - not used anymore,N/A,,,
146
+ imageDownloadChannelOpenError = 101,Unable to open Bluetooth L2CAP data channel to transfer image file,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
147
+ imageDownloadWriteFileError = 102,Failed to transfer image file over Bluetooth L2CAP,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
148
+ dcSerialUnavailable = 103,Could not fetch version info from DC,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
149
+ sendCommandUnpacking = 200,Bluetooth error trying to unpack the image file,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
150
+ sendCommandCheckingVersions = 201,Bluetooth error trying to check FW versions,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
151
+ sendCommandUpgradingDC = 202,Bluetooth error trying to upgrade the DC component,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
152
+ sendCommandUpgradingBLE = 203,Bluetooth error trying to upgrade the BLE component,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
153
+ sendCommandUpgradingSI = 204,Bluetooth error trying to upgrade the sleeve,Ensure sleeve cable is plugged in securely and try again. Reboot Control Unit and try again.,,,
154
+ sendCommandUpgradingFES = 205,Bluetooth error trying to upgrade the FES component,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
155
+ unpackTimeout = 300,Unpacking the image did not complete within the specified time,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
156
+ upgradeDCTimeout = 311,Upgrading the DC component did not complete within the specified time,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
157
+ upgradeBLETimeout = 312,Upgrading the BLE component did not complete within the specified time,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
158
+ upgradeSITimeout = 313,Upgrading the sleeve did not complete within the specified time,Ensure sleeve cable is plugged in securely and try again. Reboot Control Unit and try again.,,,
159
+ upgradeFESTimeout = 314,Upgrading the FES component did not complete within the specified time,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
160
+ restartTimeout = 302,Timed out waiting for the DC to reconnect after upgrading a component,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
161
+ unpackError = 400,Error unpacking the image file,"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
162
+ upgradeDCError = 401,Error upgrading the DC component (also see FW upgrade codes below for the second code),"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
163
+ upgradeBLEError = 402,Error upgrading the BLE component (also see FW upgrade codes below for the second code),"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
164
+ upgradeSIError = 403,Error upgrading the sleeve (also see FW upgrade codes below for the second code),Ensure sleeve cable is plugged in securely and try again.,,,
165
+ upgradeFESError = 404,Error upgrading the FES component (also see FW upgrade codes below for the second code),"Reboot Control Unit and try again, turn Bluetooth off/on, reboot phone",,,
166
+ upgradeRestartError = 405,Unexpected DC restart during the upgrade process,"Ensure Control Unit proximity and try again. If error persists, reboot Control Unit.",,,
167
+ upgradeMismatchError = 406,Upgraded components do not match what was downloaded after a successful upgrade.,Escalate immediately,,,
168
+ serverHashCheckNoImages = 500,No components found in the image file,"Try again. If that fails, escalate",,,
169
+ serverHashCheckMissingDCVersion = 501,No DC component found in the image file.,Escalate immediately,,,
170
+ serverHashCheckError = 502,Server failed to verify the image file or there was a network error,Check network connection and try again.,,,
171
+ serverUpgradeCheckFailed = 503,Could not download an image file from the server or there was a network error,"Check network connection and try again. If error persists, make sure that phone has enough free storage (> 5MB).",,,
172
+ serverNoUpgradesAvailable = 504,Not an error - server reported that no upgrades were available for the Control Unit/Sleeve,N/A,,,
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ openai == 0.28.1
2
+ langchain == 0.0.308
3
+ chromadb == 0.4.13
4
+ tiktoken == 0.5.1
5
+ pandas == 1.5.3
system_prompt.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are DylanAI, a friendly troubleshooting chatbot that helps users troubleshoot issues with their CIONIC Neural Sleeve.
2
+ You walk through troubleshooting step by step, asking the user after each step of the process to confirm they understand.
3
+ Don't have the user do more than 1 things at once. USERS SHOULD ONLY DO ONE THING AT A TIME.
4
+
5
+ Rules (you must follow all the rules):
6
+ * If you cannot answer using the sources, say you don't know.
7
+ * DO NOT GIVE USERS ADVICE THAT IS OUTSIDE OF THE SOURCES YOU ARE PROVIDED WITH. This is very important. It is most helpful to only give answers directly from the sources.
8
+ * Make things easy to understand, explain all jargon and acronyms, and explain uncommon words.
9
+ * Be concise
10
+ * You should only answer questions that are about Cionic and the Cionic Neural Sleeve.
11
+ * USERS SHOULD ONLY DO ONE THING AT A TIME.
12
+
13
+ If the user asks another question not related to the first issue, divert them to create another issue using: |*|ISSUE WIDGET (IN DEMO PRESS CLEAR BUTTON)|*| .
14
+ A new topic should trigger you to create another issue using |*|ISSUE WIDGET (IN DEMO PRESS CLEAR BUTTON)|*| .
15
+
16
+ You may need to escalate an issue to the CIONIC Support team.
17
+ Follow the appropriate escalation strategy defined in the Escalation column in the table you are provided.
18
+ When escalating to CIONIC Support, use: |*|ESCALATION WIDGET|*| .