Pablo276 commited on
Commit
96bffa5
·
verified ·
1 Parent(s): e397f91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -9,10 +9,10 @@ from langchain.agents import initialize_agent, Tool
9
  import requests
10
  from datetime import datetime
11
  import os
12
-
13
- API_O = os.environ.get("OPENAI_API_KEY")
14
 
15
 
 
16
  class CustomMemory(ConversationBufferMemory):
17
  def _get_input_output(self, inputs: Dict[str, Any], outputs: Dict[str, Any]) -> tuple:
18
  input_str = inputs.get("input", "")
@@ -70,7 +70,7 @@ def video_streaming_Test(prompt):
70
  response = get_chat_completion(prompt, content_one_time_test)
71
  if "yes" in str(response).lower():
72
  print(prompt)
73
- 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}}"
74
  else:
75
  return "There are some infomration needed missing, information needed: Start_Date "
76
 
@@ -87,7 +87,7 @@ def video_streaming_Test(prompt):
87
  response = get_chat_completion(prompt, content_multiple_tests)
88
  if "yes" in str(response).lower():
89
  print(prompt)
90
- 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}}"
91
  else:
92
  return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
93
  else:
@@ -737,6 +737,11 @@ tools = [
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
@@ -795,20 +800,12 @@ def new_chat():
795
  st.session_state["input"] = ""
796
 
797
 
798
- with st.sidebar.expander(" 🛠️ Settings ", expanded=False):
799
- MODEL = st.selectbox(
800
- label="Model",
801
- options=[
802
- "gpt-4-1106-preview",
803
- "gpt-4-turbo",
804
- "gpt-4",
805
- ],
806
- )
807
 
808
  st.title("🧠 Memory Bot 🤖")
809
  st.markdown(
810
  """
811
- > :black[**A Chatbot that remembers** Made By - Bridge2e]
812
  """
813
  )
814
 
@@ -816,6 +813,7 @@ st.markdown(
816
 
817
  # Session state storage would be ideal
818
  if API_O:
 
819
  # Load the tools
820
  # Initialize the memory object
821
  memory = CustomMemory()
 
9
  import requests
10
  from datetime import datetime
11
  import os
12
+ #TODO aggiungre la frequenza per tutti i test,
 
13
 
14
 
15
+ API_O = os.environ.get("OPENAI_API_KEY")
16
  class CustomMemory(ConversationBufferMemory):
17
  def _get_input_output(self, inputs: Dict[str, Any], outputs: Dict[str, Any]) -> tuple:
18
  input_str = inputs.get("input", "")
 
70
  response = get_chat_completion(prompt, content_one_time_test)
71
  if "yes" in str(response).lower():
72
  print(prompt)
73
+ return f"first run the new_chat tool , then 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}}"
74
  else:
75
  return "There are some infomration needed missing, information needed: Start_Date "
76
 
 
87
  response = get_chat_completion(prompt, content_multiple_tests)
88
  if "yes" in str(response).lower():
89
  print(prompt)
90
+ return f"first run the new_chat tool , then 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}}"
91
  else:
92
  return "There are some infomration needed missing, information needed: Number_of_tests, Start_Date "
93
  else:
 
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
+ Tool(
741
+ name="new_chat",
742
+ func=lambda prompt: new_chat(),
743
+ 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"
744
+ )
745
  ]
746
 
747
  # Set Streamlit page configuration
 
800
  st.session_state["input"] = ""
801
 
802
 
803
+ st.sidebar.image(r"assets\logo.png")
 
 
 
 
 
 
 
 
804
 
805
  st.title("🧠 Memory Bot 🤖")
806
  st.markdown(
807
  """
808
+ > :black[**A Chatbot that remembers** Made By - Palo Rimoldi & Bridge2e]
809
  """
810
  )
811
 
 
813
 
814
  # Session state storage would be ideal
815
  if API_O:
816
+ MODEL= "gpt-4-1106-preview"
817
  # Load the tools
818
  # Initialize the memory object
819
  memory = CustomMemory()