Spaces:
Sleeping
Sleeping
adding tools
Browse files
app.py
CHANGED
|
@@ -548,6 +548,48 @@ def sms_send_test(prompt):
|
|
| 548 |
else:
|
| 549 |
return "seems like the user did not specify the type of test: Possible choiches: 1.One time test, 2.Periodic test, 3.Driving Mode "
|
| 550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
tools = [
|
| 553 |
Tool(
|
|
@@ -684,11 +726,17 @@ tools = [
|
|
| 684 |
3: Driving Mode. Information Needed : (Number_of_tests : int, Start_Date : str[dd/mm/yy], Host_list: list, phone_number: int, sms_message: str, recover_email: str[optional]
|
| 685 |
So first of all you have to understand which tetst does the user wants to do. ask DIRECTLLY the user which test options they want to perform, don't try to guess it. Then you have to find the informaton needed for that test.Users alway forget something, if you are missing some info, just pass none.In the field date,IF AND ONLY IF users says now or today, just pass now or today. NEVER CREATE INPUT IF NOT WRITTEN BY THE USER. IN THE INPUT PASS THE INFORMATION IN JSON FORMAT. IN THE INPUR PASS THE SPECIFIED TET TYPE, ask if missing test_type:(One time test/Periodic test/Driving Mode)"""
|
| 686 |
),
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 692 |
]
|
| 693 |
|
| 694 |
# Set Streamlit page configuration
|
|
|
|
| 548 |
else:
|
| 549 |
return "seems like the user did not specify the type of test: Possible choiches: 1.One time test, 2.Periodic test, 3.Driving Mode "
|
| 550 |
|
| 551 |
+
def service_mode_tests(prompt):
|
| 552 |
+
test_name = "service_mode_tests"
|
| 553 |
+
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."
|
| 554 |
+
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."
|
| 555 |
+
|
| 556 |
+
if "One time test" in prompt:
|
| 557 |
+
if "now" in prompt:
|
| 558 |
+
now = datetime.now()
|
| 559 |
+
formatted_date = str(now.strftime("%d/%m/%Y"))
|
| 560 |
+
prompt = prompt.replace("now", formatted_date)
|
| 561 |
+
elif "today" in prompt:
|
| 562 |
+
now = datetime.now()
|
| 563 |
+
formatted_date = str(now.strftime("%d/%m/%Y"))
|
| 564 |
+
prompt = prompt.replace("today", formatted_date)
|
| 565 |
+
|
| 566 |
+
response = get_chat_completion(prompt, content_one_time_test)
|
| 567 |
+
if "yes" in str(response).lower():
|
| 568 |
+
print(prompt)
|
| 569 |
+
return f"report to the user the following json file , test started successfully: {{test_name: {test_name}, type of test : selected_type_of_test, Start_Date: selected_start_date}}"
|
| 570 |
+
else:
|
| 571 |
+
return "There are some infomration needed missing, information needed: Start_Date "
|
| 572 |
+
|
| 573 |
+
elif "Periodic test" in prompt or "Driving Mode" in prompt:
|
| 574 |
+
if "now" in prompt:
|
| 575 |
+
now = datetime.now()
|
| 576 |
+
formatted_date = str(now.strftime("%d/%m/%Y"))
|
| 577 |
+
prompt = prompt.replace("now", formatted_date)
|
| 578 |
+
elif "today" in prompt:
|
| 579 |
+
now = datetime.now()
|
| 580 |
+
formatted_date = str(now.strftime("%d/%m/%Y"))
|
| 581 |
+
prompt = prompt.replace("today", formatted_date)
|
| 582 |
+
|
| 583 |
+
response = get_chat_completion(prompt, content_multiple_tests)
|
| 584 |
+
if "yes" in str(response).lower():
|
| 585 |
+
print(prompt)
|
| 586 |
+
return f"report to the user the following json file , 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}}"
|
| 587 |
+
else:
|
| 588 |
+
return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
|
| 589 |
+
else:
|
| 590 |
+
return "seems like the user did not specify the type of test: Possible choiches: 1.One time test, 2.Periodic test, 3.Driving Mode "
|
| 591 |
+
|
| 592 |
+
|
| 593 |
|
| 594 |
tools = [
|
| 595 |
Tool(
|
|
|
|
| 726 |
3: Driving Mode. Information Needed : (Number_of_tests : int, Start_Date : str[dd/mm/yy], Host_list: list, phone_number: int, sms_message: str, recover_email: str[optional]
|
| 727 |
So first of all you have to understand which tetst does the user wants to do. ask DIRECTLLY the user which test options they want to perform, don't try to guess it. Then you have to find the informaton needed for that test.Users alway forget something, if you are missing some info, just pass none.In the field date,IF AND ONLY IF users says now or today, just pass now or today. NEVER CREATE INPUT IF NOT WRITTEN BY THE USER. IN THE INPUT PASS THE INFORMATION IN JSON FORMAT. IN THE INPUR PASS THE SPECIFIED TET TYPE, ask if missing test_type:(One time test/Periodic test/Driving Mode)"""
|
| 728 |
),
|
| 729 |
+
Tool(
|
| 730 |
+
name="service_mode_tests",
|
| 731 |
+
func=lambda prompt: service_mode_tests(prompt),
|
| 732 |
+
description="""Use when the user wants to do a service_mode_tests,
|
| 733 |
+
start the tool IF AND ONLY IF you have ALL the information needed.
|
| 734 |
+
There are three options for this test,
|
| 735 |
+
1: One time test. Information Needed : (Start_Date : str[dd/mm/yy].)
|
| 736 |
+
2: Periodic test. Information Needed : (Number_of_tests : int, Start_Date : str[dd/mm/yy].)
|
| 737 |
+
3: Driving Mode. Information Needed : (Number_of_tests : int, Start_Date : str[dd/mm/yy].)
|
| 738 |
+
So first of all you have to understand which tetst does the user wants to do.ask DIRECTLLY the user which test options they want to perform, don't try to guess it. Then you have to find the informaton needed for that test.Users alway forget something, if you are missing some info, just pass none.In the field date,IF AND ONLY IF users says now or today, just pass now or today. NEVER CREATE INPUT IF NOT WRITTEN BY THE USER. IN THE INPUT PASS THE INFORMATION IN JSON FORMAT. IN THE INPUR PASS THE SPECIFIED TET TYPE, ask if missing test_type:(One time test/Periodic test/Driving Mode)"""
|
| 739 |
+
),
|
| 740 |
]
|
| 741 |
|
| 742 |
# Set Streamlit page configuration
|