Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,8 @@ import requests
|
|
10 |
from datetime import datetime
|
11 |
import os
|
12 |
#TODO aggiungre la frequenza per tutti i test,
|
|
|
|
|
13 |
|
14 |
API_O = os.environ.get("OPENAI_API_KEY")
|
15 |
class CustomMemory(ConversationBufferMemory):
|
@@ -52,7 +54,7 @@ def get_chat_completion(user_message, content):
|
|
52 |
|
53 |
|
54 |
def video_streaming_Test(prompt):
|
55 |
-
test_name = "
|
56 |
content_one_time_test = "you only answer in shematic format,possibile asnwer are YES, NO. YES if in the prompt the Start_Date is present, No if is missing. IF 'null' is in the input , the answer is NO. ACCEPTED ANSWER : YES / NO."
|
57 |
content_multiple_tests = "you only answer in shematic format,possibile asnwer are YES, NO. YES if in the prompt, both Number_of_tests, Start_Date are present, No if even only one is missing.IF 'null' is in the input , the answer is NO. THERE CAN BE MORE IN THE PROMPT, YOU DON'T HAVE TO CAARE ABOUT IT. ACCEPTED ANSWER : YES / NO."
|
58 |
|
@@ -69,7 +71,7 @@ def video_streaming_Test(prompt):
|
|
69 |
response = get_chat_completion(prompt, content_one_time_test)
|
70 |
if "yes" in str(response).lower():
|
71 |
print(prompt)
|
72 |
-
return f"
|
73 |
else:
|
74 |
return "There are some infomration needed missing, information needed: Start_Date "
|
75 |
|
@@ -86,7 +88,7 @@ def video_streaming_Test(prompt):
|
|
86 |
response = get_chat_completion(prompt, content_multiple_tests)
|
87 |
if "yes" in str(response).lower():
|
88 |
print(prompt)
|
89 |
-
return f"
|
90 |
else:
|
91 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
92 |
else:
|
@@ -111,7 +113,7 @@ def wifi_test(prompt):
|
|
111 |
response = get_chat_completion(prompt, content_one_time_test)
|
112 |
if "yes" in str(response).lower():
|
113 |
print(prompt)
|
114 |
-
return
|
115 |
else:
|
116 |
return "There are some infomration needed missing, information needed: Start_Date "
|
117 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -127,7 +129,7 @@ def wifi_test(prompt):
|
|
127 |
response = get_chat_completion(prompt, content_multiple_tests)
|
128 |
if "yes" in str(response).lower():
|
129 |
print(prompt)
|
130 |
-
return
|
131 |
else:
|
132 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
133 |
else:
|
@@ -152,7 +154,7 @@ def iot_test(prompt):
|
|
152 |
response = get_chat_completion(prompt, content_one_time_test)
|
153 |
if "yes" in str(response).lower():
|
154 |
print(prompt)
|
155 |
-
return
|
156 |
else:
|
157 |
return "There are some infomration needed missing, information needed: 1: Start_Date, 2: Mqtt broker address, 3: Quality of Service (QoS), 4: Mqtt Message Count "
|
158 |
|
@@ -169,7 +171,7 @@ def iot_test(prompt):
|
|
169 |
response = get_chat_completion(prompt, content_multiple_tests)
|
170 |
if "yes" in str(response).lower():
|
171 |
print(prompt)
|
172 |
-
return
|
173 |
else:
|
174 |
return "There are some infomration needed missing, information needed: 1: Number_of_tests, 2: Start_Date, 3: Mqtt broker address, 4: Quality of Service (QoS), 5: Mqtt Message "
|
175 |
else:
|
@@ -194,7 +196,7 @@ def online_gaming_test(prompt):
|
|
194 |
response = get_chat_completion(prompt, content_one_time_test)
|
195 |
if "yes" in str(response).lower():
|
196 |
print(prompt)
|
197 |
-
return
|
198 |
else:
|
199 |
return "There are some infomration needed missing, information needed: Start_Date, predefined_gaming_servers "
|
200 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -210,7 +212,7 @@ def online_gaming_test(prompt):
|
|
210 |
response = get_chat_completion(prompt, content_multiple_tests)
|
211 |
if "yes" in str(response).lower():
|
212 |
print(prompt)
|
213 |
-
return
|
214 |
|
215 |
else:
|
216 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, predefined_gaming_servers "
|
@@ -235,7 +237,7 @@ def youtube_streaming_test(prompt):
|
|
235 |
response = get_chat_completion(prompt, content_one_time_test)
|
236 |
if "yes" in str(response).lower():
|
237 |
print(prompt)
|
238 |
-
return
|
239 |
else:
|
240 |
return "There are some infomration needed missing, information needed: video_quality ,Start_Date"
|
241 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -251,7 +253,7 @@ def youtube_streaming_test(prompt):
|
|
251 |
response = get_chat_completion(prompt, content_multiple_tests)
|
252 |
if "yes" in str(response).lower():
|
253 |
print(prompt)
|
254 |
-
return
|
255 |
|
256 |
else:
|
257 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, video_quality "
|
@@ -276,7 +278,7 @@ def ping_test(prompt):
|
|
276 |
response = get_chat_completion(prompt, content_one_time_test)
|
277 |
if "yes" in str(response).lower():
|
278 |
print(prompt)
|
279 |
-
return
|
280 |
else:
|
281 |
return "There are some infomration needed missing, information needed: Start_Date ,host_or_ip, ping_count"
|
282 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -292,7 +294,7 @@ def ping_test(prompt):
|
|
292 |
response = get_chat_completion(prompt, content_multiple_tests)
|
293 |
if "yes" in str(response).lower():
|
294 |
print(prompt)
|
295 |
-
return
|
296 |
else:
|
297 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, host_or_ip ping_count"
|
298 |
else:
|
@@ -316,7 +318,7 @@ def speed_test(prompt):
|
|
316 |
response = get_chat_completion(prompt, content_one_time_test)
|
317 |
if "yes" in str(response).lower():
|
318 |
print(prompt)
|
319 |
-
return
|
320 |
else:
|
321 |
return "There are some infomration needed missing, information needed: Start_Date, Speed_type "
|
322 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -332,7 +334,7 @@ def speed_test(prompt):
|
|
332 |
response = get_chat_completion(prompt, content_multiple_tests)
|
333 |
if "yes" in str(response).lower():
|
334 |
print(prompt)
|
335 |
-
return
|
336 |
|
337 |
else:
|
338 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Speed_type"
|
@@ -357,7 +359,7 @@ def web_browsing_test(prompt):
|
|
357 |
response = get_chat_completion(prompt, content_one_time_test)
|
358 |
if "yes" in str(response).lower():
|
359 |
print(prompt)
|
360 |
-
return
|
361 |
else:
|
362 |
return "There are some infomration needed missing, information needed: Start_Date, Host_list"
|
363 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -373,7 +375,7 @@ def web_browsing_test(prompt):
|
|
373 |
response = get_chat_completion(prompt, content_multiple_tests)
|
374 |
if "yes" in str(response).lower():
|
375 |
print(prompt)
|
376 |
-
return
|
377 |
|
378 |
else:
|
379 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Host_list"
|
@@ -398,7 +400,7 @@ def call_receive_test(prompt):
|
|
398 |
response = get_chat_completion(prompt, content_one_time_test)
|
399 |
if "yes" in str(response).lower():
|
400 |
print(prompt)
|
401 |
-
return
|
402 |
else:
|
403 |
return "There are some infomration needed missing, information needed: Start_Date "
|
404 |
|
@@ -415,7 +417,7 @@ def call_receive_test(prompt):
|
|
415 |
response = get_chat_completion(prompt, content_multiple_tests)
|
416 |
if "yes" in str(response).lower():
|
417 |
print(prompt)
|
418 |
-
return
|
419 |
else:
|
420 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
421 |
else:
|
@@ -439,7 +441,7 @@ def sms_receive_test(prompt):
|
|
439 |
response = get_chat_completion(prompt, content_one_time_test)
|
440 |
if "yes" in str(response).lower():
|
441 |
print(prompt)
|
442 |
-
return
|
443 |
else:
|
444 |
return "There are some infomration needed missing, information needed: Start_Date "
|
445 |
|
@@ -456,7 +458,7 @@ def sms_receive_test(prompt):
|
|
456 |
response = get_chat_completion(prompt, content_multiple_tests)
|
457 |
if "yes" in str(response).lower():
|
458 |
print(prompt)
|
459 |
-
return
|
460 |
else:
|
461 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
462 |
else:
|
@@ -481,7 +483,7 @@ def voice_call_test(prompt):
|
|
481 |
response = get_chat_completion(prompt, content_one_time_test)
|
482 |
if "yes" in str(response).lower():
|
483 |
print(prompt)
|
484 |
-
return
|
485 |
else:
|
486 |
return "There are some infomration needed missing, information needed: Start_Date, Phone_number"
|
487 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -497,7 +499,7 @@ def voice_call_test(prompt):
|
|
497 |
response = get_chat_completion(prompt, content_multiple_tests)
|
498 |
if "yes" in str(response).lower():
|
499 |
print(prompt)
|
500 |
-
return
|
501 |
|
502 |
else:
|
503 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Phone_number"
|
@@ -524,7 +526,7 @@ def sms_send_test(prompt):
|
|
524 |
response = get_chat_completion(prompt, content_one_time_test)
|
525 |
if "yes" in str(response).lower():
|
526 |
print(prompt)
|
527 |
-
return
|
528 |
else:
|
529 |
return "There are some infomration needed missing, information needed: Start_Date, phone_number, sms_message"
|
530 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
@@ -540,7 +542,7 @@ def sms_send_test(prompt):
|
|
540 |
response = get_chat_completion(prompt, content_multiple_tests)
|
541 |
if "yes" in str(response).lower():
|
542 |
print(prompt)
|
543 |
-
return
|
544 |
|
545 |
else:
|
546 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, phone_number, sms_message"
|
@@ -565,7 +567,7 @@ def service_mode_tests(prompt):
|
|
565 |
response = get_chat_completion(prompt, content_one_time_test)
|
566 |
if "yes" in str(response).lower():
|
567 |
print(prompt)
|
568 |
-
return
|
569 |
else:
|
570 |
return "There are some infomration needed missing, information needed: Start_Date "
|
571 |
|
@@ -582,7 +584,7 @@ def service_mode_tests(prompt):
|
|
582 |
response = get_chat_completion(prompt, content_multiple_tests)
|
583 |
if "yes" in str(response).lower():
|
584 |
print(prompt)
|
585 |
-
return
|
586 |
else:
|
587 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
588 |
else:
|
@@ -739,7 +741,7 @@ tools = [
|
|
739 |
Tool(
|
740 |
name="new_chat",
|
741 |
func=lambda prompt: new_chat(),
|
742 |
-
description="use this tool always when the agent made to finish a succesfull action, when the chain is finished, this tool is used to clear the chat and to create a new one"
|
743 |
)
|
744 |
]
|
745 |
|
@@ -765,7 +767,7 @@ if "input" not in st.session_state:
|
|
765 |
if "stored_session" not in st.session_state:
|
766 |
st.session_state["stored_session"] = []
|
767 |
|
768 |
-
# Define
|
769 |
|
770 |
|
771 |
def get_text():
|
@@ -777,7 +779,7 @@ def get_text():
|
|
777 |
"""
|
778 |
input_text = st.text_input(
|
779 |
"You: ",
|
780 |
-
st.session_state
|
781 |
key="input",
|
782 |
placeholder="Enter a command or query here...",
|
783 |
label_visibility="hidden",
|
@@ -796,7 +798,9 @@ def new_chat():
|
|
796 |
st.session_state["stored_session"].append(save)
|
797 |
st.session_state["generated"] = []
|
798 |
st.session_state["past"] = []
|
799 |
-
st.session_state["
|
|
|
|
|
800 |
|
801 |
|
802 |
st.sidebar.image("./assets/logo.png")
|
@@ -804,7 +808,7 @@ st.sidebar.image("./assets/logo.png")
|
|
804 |
st.title("🧠 Memory Bot 🤖")
|
805 |
st.markdown(
|
806 |
"""
|
807 |
-
> :black[**A Chatbot that remembers** Made By -
|
808 |
"""
|
809 |
)
|
810 |
|
@@ -813,6 +817,7 @@ st.markdown(
|
|
813 |
# Session state storage would be ideal
|
814 |
if API_O:
|
815 |
MODEL= "gpt-4-1106-preview"
|
|
|
816 |
# Load the tools
|
817 |
# Initialize the memory object
|
818 |
memory = CustomMemory()
|
|
|
10 |
from datetime import datetime
|
11 |
import os
|
12 |
#TODO aggiungre la frequenza per tutti i test,
|
13 |
+
import uuid
|
14 |
+
|
15 |
|
16 |
API_O = os.environ.get("OPENAI_API_KEY")
|
17 |
class CustomMemory(ConversationBufferMemory):
|
|
|
54 |
|
55 |
|
56 |
def video_streaming_Test(prompt):
|
57 |
+
test_name = "video_streaming_test"
|
58 |
content_one_time_test = "you only answer in shematic format,possibile asnwer are YES, NO. YES if in the prompt the Start_Date is present, No if is missing. IF 'null' is in the input , the answer is NO. ACCEPTED ANSWER : YES / NO."
|
59 |
content_multiple_tests = "you only answer in shematic format,possibile asnwer are YES, NO. YES if in the prompt, both Number_of_tests, Start_Date are present, No if even only one is missing.IF 'null' is in the input , the answer is NO. THERE CAN BE MORE IN THE PROMPT, YOU DON'T HAVE TO CAARE ABOUT IT. ACCEPTED ANSWER : YES / NO."
|
60 |
|
|
|
71 |
response = get_chat_completion(prompt, content_one_time_test)
|
72 |
if "yes" in str(response).lower():
|
73 |
print(prompt)
|
74 |
+
return f"1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
75 |
else:
|
76 |
return "There are some infomration needed missing, information needed: Start_Date "
|
77 |
|
|
|
88 |
response = get_chat_completion(prompt, content_multiple_tests)
|
89 |
if "yes" in str(response).lower():
|
90 |
print(prompt)
|
91 |
+
return f"1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date}}"
|
92 |
else:
|
93 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
94 |
else:
|
|
|
113 |
response = get_chat_completion(prompt, content_one_time_test)
|
114 |
if "yes" in str(response).lower():
|
115 |
print(prompt)
|
116 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
117 |
else:
|
118 |
return "There are some infomration needed missing, information needed: Start_Date "
|
119 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
129 |
response = get_chat_completion(prompt, content_multiple_tests)
|
130 |
if "yes" in str(response).lower():
|
131 |
print(prompt)
|
132 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date}}"
|
133 |
else:
|
134 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
135 |
else:
|
|
|
154 |
response = get_chat_completion(prompt, content_one_time_test)
|
155 |
if "yes" in str(response).lower():
|
156 |
print(prompt)
|
157 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, Mqtt broker address: selected_Mqtt_broker_address, Quality of Service (QoS): selected_Quality_of_Service, Mqtt Message Count: selected_Mqtt_Message_Count }}"
|
158 |
else:
|
159 |
return "There are some infomration needed missing, information needed: 1: Start_Date, 2: Mqtt broker address, 3: Quality of Service (QoS), 4: Mqtt Message Count "
|
160 |
|
|
|
171 |
response = get_chat_completion(prompt, content_multiple_tests)
|
172 |
if "yes" in str(response).lower():
|
173 |
print(prompt)
|
174 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, Mqtt broker address: selected_Mqtt_broker_address, Quality of Service (QoS): selected_Quality_of_Service, Mqtt Message Count}}"
|
175 |
else:
|
176 |
return "There are some infomration needed missing, information needed: 1: Number_of_tests, 2: Start_Date, 3: Mqtt broker address, 4: Quality of Service (QoS), 5: Mqtt Message "
|
177 |
else:
|
|
|
196 |
response = get_chat_completion(prompt, content_one_time_test)
|
197 |
if "yes" in str(response).lower():
|
198 |
print(prompt)
|
199 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, game_servers: predefined_gaming_servers}}"
|
200 |
else:
|
201 |
return "There are some infomration needed missing, information needed: Start_Date, predefined_gaming_servers "
|
202 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
212 |
response = get_chat_completion(prompt, content_multiple_tests)
|
213 |
if "yes" in str(response).lower():
|
214 |
print(prompt)
|
215 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, game_servers: predefined_gaming_servers}}"
|
216 |
|
217 |
else:
|
218 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, predefined_gaming_servers "
|
|
|
237 |
response = get_chat_completion(prompt, content_one_time_test)
|
238 |
if "yes" in str(response).lower():
|
239 |
print(prompt)
|
240 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, video_quality: selected_video_quality}}"
|
241 |
else:
|
242 |
return "There are some infomration needed missing, information needed: video_quality ,Start_Date"
|
243 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
253 |
response = get_chat_completion(prompt, content_multiple_tests)
|
254 |
if "yes" in str(response).lower():
|
255 |
print(prompt)
|
256 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, video_quality: selected_video_quality}}"
|
257 |
|
258 |
else:
|
259 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, video_quality "
|
|
|
278 |
response = get_chat_completion(prompt, content_one_time_test)
|
279 |
if "yes" in str(response).lower():
|
280 |
print(prompt)
|
281 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date,host_or_ip: selected_host_or_ip, ping_count: selected_ping_count }}"
|
282 |
else:
|
283 |
return "There are some infomration needed missing, information needed: Start_Date ,host_or_ip, ping_count"
|
284 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
294 |
response = get_chat_completion(prompt, content_multiple_tests)
|
295 |
if "yes" in str(response).lower():
|
296 |
print(prompt)
|
297 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date,host_or_ip: selected_host_or_ip, ping_count: selected_ping_count }}"
|
298 |
else:
|
299 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, host_or_ip ping_count"
|
300 |
else:
|
|
|
318 |
response = get_chat_completion(prompt, content_one_time_test)
|
319 |
if "yes" in str(response).lower():
|
320 |
print(prompt)
|
321 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, Speed_type: selected_Speed_type}}"
|
322 |
else:
|
323 |
return "There are some infomration needed missing, information needed: Start_Date, Speed_type "
|
324 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
334 |
response = get_chat_completion(prompt, content_multiple_tests)
|
335 |
if "yes" in str(response).lower():
|
336 |
print(prompt)
|
337 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, Speed_type: selected_Speed_type}}"
|
338 |
|
339 |
else:
|
340 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Speed_type"
|
|
|
359 |
response = get_chat_completion(prompt, content_one_time_test)
|
360 |
if "yes" in str(response).lower():
|
361 |
print(prompt)
|
362 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, Host_list: selected_Host_list}}"
|
363 |
else:
|
364 |
return "There are some infomration needed missing, information needed: Start_Date, Host_list"
|
365 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
375 |
response = get_chat_completion(prompt, content_multiple_tests)
|
376 |
if "yes" in str(response).lower():
|
377 |
print(prompt)
|
378 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, Host_list: selected_Host_list}}"
|
379 |
|
380 |
else:
|
381 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Host_list"
|
|
|
400 |
response = get_chat_completion(prompt, content_one_time_test)
|
401 |
if "yes" in str(response).lower():
|
402 |
print(prompt)
|
403 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
404 |
else:
|
405 |
return "There are some infomration needed missing, information needed: Start_Date "
|
406 |
|
|
|
417 |
response = get_chat_completion(prompt, content_multiple_tests)
|
418 |
if "yes" in str(response).lower():
|
419 |
print(prompt)
|
420 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date}}"
|
421 |
else:
|
422 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
423 |
else:
|
|
|
441 |
response = get_chat_completion(prompt, content_one_time_test)
|
442 |
if "yes" in str(response).lower():
|
443 |
print(prompt)
|
444 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
445 |
else:
|
446 |
return "There are some infomration needed missing, information needed: Start_Date "
|
447 |
|
|
|
458 |
response = get_chat_completion(prompt, content_multiple_tests)
|
459 |
if "yes" in str(response).lower():
|
460 |
print(prompt)
|
461 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date}}"
|
462 |
else:
|
463 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
464 |
else:
|
|
|
483 |
response = get_chat_completion(prompt, content_one_time_test)
|
484 |
if "yes" in str(response).lower():
|
485 |
print(prompt)
|
486 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, Phone_number: selected_Phone_number}}"
|
487 |
else:
|
488 |
return "There are some infomration needed missing, information needed: Start_Date, Phone_number"
|
489 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
499 |
response = get_chat_completion(prompt, content_multiple_tests)
|
500 |
if "yes" in str(response).lower():
|
501 |
print(prompt)
|
502 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, Phone_number: selected_Phone_number}}"
|
503 |
|
504 |
else:
|
505 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, Phone_number"
|
|
|
526 |
response = get_chat_completion(prompt, content_one_time_test)
|
527 |
if "yes" in str(response).lower():
|
528 |
print(prompt)
|
529 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date, phone_number: selected_phone_number, sms_message: selected_sms_message}}"
|
530 |
else:
|
531 |
return "There are some infomration needed missing, information needed: Start_Date, phone_number, sms_message"
|
532 |
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
|
|
542 |
response = get_chat_completion(prompt, content_multiple_tests)
|
543 |
if "yes" in str(response).lower():
|
544 |
print(prompt)
|
545 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date, phone_number: selected_phone_number, sms_message: selected_sms_message}}"
|
546 |
|
547 |
else:
|
548 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date, phone_number, sms_message"
|
|
|
567 |
response = get_chat_completion(prompt, content_one_time_test)
|
568 |
if "yes" in str(response).lower():
|
569 |
print(prompt)
|
570 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
571 |
else:
|
572 |
return "There are some infomration needed missing, information needed: Start_Date "
|
573 |
|
|
|
584 |
response = get_chat_completion(prompt, content_multiple_tests)
|
585 |
if "yes" in str(response).lower():
|
586 |
print(prompt)
|
587 |
+
return "1. run the new_chat tool, 2. report to the user in json format: test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Number_of_tests: selected_number_of_tests, Start_Date: selected_start_date}}"
|
588 |
else:
|
589 |
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
590 |
else:
|
|
|
741 |
Tool(
|
742 |
name="new_chat",
|
743 |
func=lambda prompt: new_chat(),
|
744 |
+
description="use this tool always when the agent made to finish a succesfull action, when the chain is finished, this tool is used to clear the chat and to create a new one. Use whrn the agent decides to use the new_chat tool"
|
745 |
)
|
746 |
]
|
747 |
|
|
|
767 |
if "stored_session" not in st.session_state:
|
768 |
st.session_state["stored_session"] = []
|
769 |
|
770 |
+
# Define tool to get user input
|
771 |
|
772 |
|
773 |
def get_text():
|
|
|
779 |
"""
|
780 |
input_text = st.text_input(
|
781 |
"You: ",
|
782 |
+
st.session_state.get("user_input", ""), # Retrieve user input from new key
|
783 |
key="input",
|
784 |
placeholder="Enter a command or query here...",
|
785 |
label_visibility="hidden",
|
|
|
798 |
st.session_state["stored_session"].append(save)
|
799 |
st.session_state["generated"] = []
|
800 |
st.session_state["past"] = []
|
801 |
+
st.session_state["user_input"] = "" # Clear user input
|
802 |
+
st.session_state["bot_response"] = "" # Clear bot response
|
803 |
+
|
804 |
|
805 |
|
806 |
st.sidebar.image("./assets/logo.png")
|
|
|
808 |
st.title("🧠 Memory Bot 🤖")
|
809 |
st.markdown(
|
810 |
"""
|
811 |
+
> :black[**A Chatbot that remembers** Made By - Bridge2e]
|
812 |
"""
|
813 |
)
|
814 |
|
|
|
817 |
# Session state storage would be ideal
|
818 |
if API_O:
|
819 |
MODEL= "gpt-4-1106-preview"
|
820 |
+
|
821 |
# Load the tools
|
822 |
# Initialize the memory object
|
823 |
memory = CustomMemory()
|