Update app.py
Browse files
app.py
CHANGED
|
@@ -267,45 +267,82 @@ def ask_question(message, history):
|
|
| 267 |
# "Reterive policy information using PolicyRetrievalRAG tool and answer the user questions."
|
| 268 |
# "Always use data returned by the policy. Do not makeup information."
|
| 269 |
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
advisory_prompt = (
|
| 271 |
"Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
|
| 272 |
-
"Always base your response strictly on the actual policy content—do not fabricate or assume.\n\n"
|
| 273 |
-
|
| 274 |
-
"Respond strictly in this structured format:\n\n"
|
| 275 |
|
| 276 |
-
"
|
|
|
|
|
|
|
|
|
|
| 277 |
"- Quote or paraphrase the most relevant clauses from the policy.\n\n"
|
| 278 |
|
| 279 |
-
"Simplified Explanation
|
| 280 |
"- Translate the policy language into simple, user-friendly language.\n\n"
|
| 281 |
|
| 282 |
-
"Advisor’s Practical Tip
|
| 283 |
"- Give actionable tips to help the user get the most from their policy.\n\n"
|
| 284 |
|
| 285 |
-
"Caveats and Exclusions
|
| 286 |
"- Mention any exclusions, limitations, or waiting periods.\n\n"
|
| 287 |
|
| 288 |
-
"Your tone should be empathetic and clear—like a smart, helpful insurance advisor.\n"
|
| 289 |
-
"
|
| 290 |
-
"Always include all four sections in the output.\n\n"
|
| 291 |
|
| 292 |
"---\n"
|
| 293 |
-
"### Example Response
|
| 294 |
-
"
|
| 295 |
-
"
|
| 296 |
-
"
|
| 297 |
-
|
| 298 |
-
"
|
| 299 |
-
"-
|
| 300 |
-
|
| 301 |
-
"
|
| 302 |
-
"
|
| 303 |
-
|
| 304 |
-
"###
|
| 305 |
-
"
|
| 306 |
-
"Simplified Explanation:\n- You have to wait 2 years before claims related to past illnesses are covered.\n\n"
|
| 307 |
-
"Advisor’s Practical Tip:\n- Consider a top-up or rider that waives this waiting period.\n\n"
|
| 308 |
-
"Caveats and Exclusions:\n- Diabetes and hypertension are included in pre-existing illnesses list.\n\n"
|
| 309 |
)
|
| 310 |
|
| 311 |
|
|
|
|
| 267 |
# "Reterive policy information using PolicyRetrievalRAG tool and answer the user questions."
|
| 268 |
# "Always use data returned by the policy. Do not makeup information."
|
| 269 |
# )
|
| 270 |
+
# advisory_prompt = (
|
| 271 |
+
# "Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
|
| 272 |
+
# "Always base your response strictly on the actual policy content—do not fabricate or assume.\n\n"
|
| 273 |
+
|
| 274 |
+
# "Respond strictly in this structured format:\n\n"
|
| 275 |
+
|
| 276 |
+
# "Policy Details: \n"
|
| 277 |
+
# "- Quote or paraphrase the most relevant clauses from the policy.\n\n"
|
| 278 |
+
|
| 279 |
+
# "Simplified Explanation:\n"
|
| 280 |
+
# "- Translate the policy language into simple, user-friendly language.\n\n"
|
| 281 |
+
|
| 282 |
+
# "Advisor’s Practical Tip:\n"
|
| 283 |
+
# "- Give actionable tips to help the user get the most from their policy.\n\n"
|
| 284 |
+
|
| 285 |
+
# "Caveats and Exclusions:\n"
|
| 286 |
+
# "- Mention any exclusions, limitations, or waiting periods.\n\n"
|
| 287 |
+
|
| 288 |
+
# "Your tone should be empathetic and clear—like a smart, helpful insurance advisor.\n"
|
| 289 |
+
# "Respond with text only. Do not use Emoji."
|
| 290 |
+
# "Always include all four sections in the output.\n\n"
|
| 291 |
+
|
| 292 |
+
# "---\n"
|
| 293 |
+
# "### Example Response Format:\n"
|
| 294 |
+
# "Policy Details:\n"
|
| 295 |
+
# "- ...\n\n"
|
| 296 |
+
# "Simplified Explanation:\n"
|
| 297 |
+
# "- ...\n\n"
|
| 298 |
+
# "Advisor’s Practical Tip:\n"
|
| 299 |
+
# "- ...\n\n"
|
| 300 |
+
# "Caveats and Exclusions:\n"
|
| 301 |
+
# "- ...\n"
|
| 302 |
+
# "---"
|
| 303 |
+
# "---\n"
|
| 304 |
+
# "### Example Response:\n"
|
| 305 |
+
# "Policy Details:\n- The policy offers 24-month waiting period for pre-existing conditions.\n\n"
|
| 306 |
+
# "Simplified Explanation:\n- You have to wait 2 years before claims related to past illnesses are covered.\n\n"
|
| 307 |
+
# "Advisor’s Practical Tip:\n- Consider a top-up or rider that waives this waiting period.\n\n"
|
| 308 |
+
# "Caveats and Exclusions:\n- Diabetes and hypertension are included in pre-existing illnesses list.\n\n"
|
| 309 |
+
# )
|
| 310 |
advisory_prompt = (
|
| 311 |
"Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
|
| 312 |
+
"Always base your response strictly on the actual policy content — do not fabricate or assume.\n\n"
|
|
|
|
|
|
|
| 313 |
|
| 314 |
+
"Respond strictly in this structured format using **Markdown** with **emojis**, and wrap everything inside a `Final Answer:` block for compatibility:\n\n"
|
| 315 |
+
|
| 316 |
+
"Final Answer:\n"
|
| 317 |
+
"### 📄 Policy Details\n"
|
| 318 |
"- Quote or paraphrase the most relevant clauses from the policy.\n\n"
|
| 319 |
|
| 320 |
+
"### 🧠 Simplified Explanation\n"
|
| 321 |
"- Translate the policy language into simple, user-friendly language.\n\n"
|
| 322 |
|
| 323 |
+
"### 💡 Advisor’s Practical Tip\n"
|
| 324 |
"- Give actionable tips to help the user get the most from their policy.\n\n"
|
| 325 |
|
| 326 |
+
"### ⚠️ Caveats and Exclusions\n"
|
| 327 |
"- Mention any exclusions, limitations, or waiting periods.\n\n"
|
| 328 |
|
| 329 |
+
"Your tone should be empathetic and clear — like a smart, helpful insurance advisor.\n"
|
| 330 |
+
"Always include **all four** sections.\n\n"
|
|
|
|
| 331 |
|
| 332 |
"---\n"
|
| 333 |
+
"### ✅ Example Response:\n"
|
| 334 |
+
"Final Answer:\n"
|
| 335 |
+
"### 📄 Policy Details\n"
|
| 336 |
+
"- The policy includes a 24-month waiting period for pre-existing conditions.\n\n"
|
| 337 |
+
|
| 338 |
+
"### 🧠 Simplified Explanation\n"
|
| 339 |
+
"- You need to wait 2 years before any claims related to older health issues are covered.\n\n"
|
| 340 |
+
|
| 341 |
+
"### 💡 Advisor’s Practical Tip\n"
|
| 342 |
+
"- Explore top-up plans that might waive or reduce the waiting period.\n\n"
|
| 343 |
+
|
| 344 |
+
"### ⚠️ Caveats and Exclusions\n"
|
| 345 |
+
"- Conditions like diabetes and hypertension are counted as pre-existing, so they'll be excluded during the waiting period.\n"
|
|
|
|
|
|
|
|
|
|
| 346 |
)
|
| 347 |
|
| 348 |
|