Update app.py
Browse files
app.py
CHANGED
@@ -135,7 +135,16 @@ def create_conversational_rag_chain(vectorstore):
|
|
135 |
which can be understood without the chat history. Do NOT answer the question,
|
136 |
just reformulate it if needed and otherwise return it as is."""
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
qa_system_prompt = """You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Be as informative as possible, be polite and formal.\n{context}"""
|
141 |
|
|
|
135 |
which can be understood without the chat history. Do NOT answer the question,
|
136 |
just reformulate it if needed and otherwise return it as is."""
|
137 |
|
138 |
+
|
139 |
+
contextualize_q_prompt = ChatPromptTemplate.from_messages(
|
140 |
+
[
|
141 |
+
("system", contextualize_q_system_prompt),
|
142 |
+
MessagesPlaceholder("chat_history"),
|
143 |
+
("human", "{input}"),
|
144 |
+
]
|
145 |
+
)
|
146 |
+
|
147 |
+
ha_retriever = create_history_aware_retriever(llm, vectorstore.as_retriever(), contextualize_q_prompt)
|
148 |
|
149 |
qa_system_prompt = """You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Be as informative as possible, be polite and formal.\n{context}"""
|
150 |
|