Update app.py
Browse files
app.py
CHANGED
|
@@ -174,22 +174,12 @@ def create_conversational_rag_chain(retriever):
|
|
| 174 |
verbose=False,
|
| 175 |
)
|
| 176 |
|
| 177 |
-
template = """
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
**You should not use personal opinions when answering questions; instead you must rely solely upon context**
|
| 181 |
-
|
| 182 |
-
The context contains documents with a 'page_content' field and potentially other metadata. Focus on the 'page_content' field for information retrieval.
|
| 183 |
-
|
| 184 |
-
When answering, prioritize including all relevant details from the context to support your response. Avoid yes/no answers or simple options (A, B, etc.).
|
| 185 |
-
|
| 186 |
-
**In the answer, use only English language. DO NOT ASK more questions by yourself!**
|
| 187 |
-
|
| 188 |
-
**Question:** {question}
|
| 189 |
-
**Context:** {context}
|
| 190 |
-
Answer:
|
| 191 |
"""
|
| 192 |
-
prompt = ChatPromptTemplate.from_template(template
|
|
|
|
| 193 |
|
| 194 |
|
| 195 |
rag_chain = prompt | llm | StrOutputParser()
|
|
|
|
| 174 |
verbose=False,
|
| 175 |
)
|
| 176 |
|
| 177 |
+
template = """Answer the question based only on the following context:
|
| 178 |
+
{context}
|
| 179 |
+
Question: {question}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
"""
|
| 181 |
+
prompt = ChatPromptTemplate.from_template(template)
|
| 182 |
+
|
| 183 |
|
| 184 |
|
| 185 |
rag_chain = prompt | llm | StrOutputParser()
|