Update app.py
Browse files
app.py
CHANGED
@@ -174,7 +174,9 @@ def create_conversational_rag_chain(retriever):
|
|
174 |
verbose=False,
|
175 |
)
|
176 |
|
177 |
-
template = """**Given the context (format: dictionary) and question, provide a comprehensive answer in natural language that addresses the question directly.
|
|
|
|
|
178 |
|
179 |
The context contains documents with a 'page_content' field and potentially other metadata. Focus on the 'page_content' field for information retrieval.
|
180 |
|
@@ -184,7 +186,10 @@ When answering, prioritize including all relevant details from the context to su
|
|
184 |
|
185 |
**Question:** {question}
|
186 |
**Context:** {context}
|
187 |
-
**Answer:** (
|
|
|
|
|
|
|
188 |
"""
|
189 |
prompt = ChatPromptTemplate.from_template(template, role='ai')
|
190 |
|
|
|
174 |
verbose=False,
|
175 |
)
|
176 |
|
177 |
+
template = """**Given the context (format: dictionary) and question, provide a comprehensive answer in natural language that addresses the question directly.
|
178 |
+
|
179 |
+
**Indicate the confidence level in the answer based on how well it aligns with the information in the context (high, medium, low).**
|
180 |
|
181 |
The context contains documents with a 'page_content' field and potentially other metadata. Focus on the 'page_content' field for information retrieval.
|
182 |
|
|
|
186 |
|
187 |
**Question:** {question}
|
188 |
**Context:** {context}
|
189 |
+
**Answer:** (answer)
|
190 |
+
|
191 |
+
**Confidence Level:** (high/medium/low) - Briefly explain why this confidence level is assigned based on the context.
|
192 |
+
For example: "High confidence - The answer is directly supported by Article 32 of the LR_Constitution_2022.")
|
193 |
"""
|
194 |
prompt = ChatPromptTemplate.from_template(template, role='ai')
|
195 |
|