Update app.py
Browse files
app.py
CHANGED
|
@@ -43,29 +43,41 @@ def initialize():
|
|
| 43 |
)
|
| 44 |
|
| 45 |
prompt = ChatPromptTemplate.from_template("""
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
{context}
|
| 65 |
|
| 66 |
-
|
| 67 |
{input}
|
| 68 |
-
|
| 69 |
""")
|
| 70 |
|
| 71 |
doc_chain = create_stuff_documents_chain(llm, prompt)
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
prompt = ChatPromptTemplate.from_template("""
|
| 46 |
+
You are a strict retrieval-based Insurance Policy Assistant.
|
| 47 |
+
|
| 48 |
+
You MUST follow these constraints:
|
| 49 |
+
|
| 50 |
+
- Use ONLY the provided context.
|
| 51 |
+
- Do NOT rely on external knowledge.
|
| 52 |
+
- Do NOT infer beyond what is explicitly stated.
|
| 53 |
+
- If answer is missing → respond exactly:
|
| 54 |
+
"Not found in document"
|
| 55 |
+
- If partially available but unclear → respond:
|
| 56 |
+
"Uncertain based on provided context"
|
| 57 |
+
|
| 58 |
+
DECISION RULES:
|
| 59 |
+
- "Yes" → explicitly covered in context
|
| 60 |
+
- "No" → explicitly excluded in context
|
| 61 |
+
- "Uncertain" → not clearly stated or conflicting info
|
| 62 |
+
|
| 63 |
+
OUTPUT FORMAT (STRICT):
|
| 64 |
+
|
| 65 |
+
Coverage: <Yes / No / Uncertain>
|
| 66 |
+
|
| 67 |
+
Explanation:
|
| 68 |
+
- Step-by-step reasoning from context
|
| 69 |
+
- Include all relevant conditions, exclusions, and scenarios
|
| 70 |
+
|
| 71 |
+
Reference:
|
| 72 |
+
- Exact supporting lines or summarized clauses from context
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
CONTEXT:
|
| 77 |
{context}
|
| 78 |
|
| 79 |
+
QUESTION:
|
| 80 |
{input}
|
|
|
|
| 81 |
""")
|
| 82 |
|
| 83 |
doc_chain = create_stuff_documents_chain(llm, prompt)
|