Update app.py
Browse files
app.py
CHANGED
@@ -91,15 +91,14 @@ def create_retriever_from_chroma(vectorstore_path="docs/chroma/", search_type='m
|
|
91 |
contextualize_q_system_prompt = """If the question is not clear, given a chat history and the latest user question
|
92 |
which maybe reference context, formulate a standalone question,
|
93 |
which can be understood without the chat history. Do NOT answer the question,
|
94 |
-
just reformulate it if needed and otherwise return it as is."""
|
95 |
|
96 |
-
)
|
97 |
|
98 |
contextualize_q_prompt = ChatPromptTemplate.from_messages(
|
99 |
[
|
100 |
("system", contextualize_q_system_prompt),
|
101 |
MessagesPlaceholder("chat_history"),
|
102 |
-
("human", "{
|
103 |
]
|
104 |
)
|
105 |
|
@@ -148,7 +147,7 @@ def main():
|
|
148 |
def handle_userinput(user_question,retriever):
|
149 |
st.session_state.messages.append({"role": "user", "content": user_question})
|
150 |
st.chat_message("user").write(user_question)
|
151 |
-
docs = retriever.invoke(user_question)
|
152 |
|
153 |
with st.sidebar:
|
154 |
st.subheader("Your documents")
|
|
|
91 |
contextualize_q_system_prompt = """If the question is not clear, given a chat history and the latest user question
|
92 |
which maybe reference context, formulate a standalone question,
|
93 |
which can be understood without the chat history. Do NOT answer the question,
|
94 |
+
just reformulate it if needed and otherwise return it as is.""")
|
95 |
|
|
|
96 |
|
97 |
contextualize_q_prompt = ChatPromptTemplate.from_messages(
|
98 |
[
|
99 |
("system", contextualize_q_system_prompt),
|
100 |
MessagesPlaceholder("chat_history"),
|
101 |
+
("human", "{question}"),
|
102 |
]
|
103 |
)
|
104 |
|
|
|
147 |
def handle_userinput(user_question,retriever):
|
148 |
st.session_state.messages.append({"role": "user", "content": user_question})
|
149 |
st.chat_message("user").write(user_question)
|
150 |
+
docs = retriever.invoke({"question": user_question, "chat_history": st.session_state.messages})
|
151 |
|
152 |
with st.sidebar:
|
153 |
st.subheader("Your documents")
|