tawfik.gh commited on
Commit
75e09c0
1 Parent(s): c55c319

history docs

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -12,6 +12,7 @@ st.title("🤖 Welcome in :blue[_fam_ _properties_] ChatBot :sunglasses:")
12
 
13
  index_name = "fam-rag"
14
  docs = []
 
15
 
16
  encoder = HuggingFaceEncoder(name="dwzhu/e5-base-4k")
17
 
@@ -58,15 +59,22 @@ if prompt := st.chat_input("What is up?"):
58
 
59
  if not prompt.__contains__("Yes") or not prompt.__contains__("No"):
60
  docs = oracle_db(prompt, 5)
 
 
 
 
 
 
 
61
 
62
  # result = generate(prompt, docs, groq_client, st.session_state.messages)
63
 
64
- docs = "\n---\n".join([str(i) for i in docs])
65
 
66
  system_message =f'''
67
  You are a real state assistant and agent act as that and help users find best properties and there transition in Dubai that fit there requirement using the
68
  context and chat history provided below.
69
- please be precise when you answer the user and get the answer from your history if the question is not related to the context.
70
  if you ask the user a yes/no question do not use the provided context for response, use chat history for answer instead.
71
 
72
  if the context or the chat history may not have the answer of the question get the answer from chat history if not related please
 
12
 
13
  index_name = "fam-rag"
14
  docs = []
15
+ history_docs = []
16
 
17
  encoder = HuggingFaceEncoder(name="dwzhu/e5-base-4k")
18
 
 
59
 
60
  if not prompt.__contains__("Yes") or not prompt.__contains__("No"):
61
  docs = oracle_db(prompt, 5)
62
+ if len(history_docs) == 3:
63
+ history_docs = []
64
+ history_docs.append(docs)
65
+ else:
66
+ history_docs.append(docs)
67
+
68
+
69
 
70
  # result = generate(prompt, docs, groq_client, st.session_state.messages)
71
 
72
+ docs = "\n---\n".join([str(i) for doc in history_docs for i in doc ])
73
 
74
  system_message =f'''
75
  You are a real state assistant and agent act as that and help users find best properties and there transition in Dubai that fit there requirement using the
76
  context and chat history provided below.
77
+ please be precise when you answer the user with Full specifications and details and get the answer from your history if the question is not related to the context.
78
  if you ask the user a yes/no question do not use the provided context for response, use chat history for answer instead.
79
 
80
  if the context or the chat history may not have the answer of the question get the answer from chat history if not related please