Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -117,12 +117,24 @@ def get_conversational_chain():
|
|
| 117 |
return None
|
| 118 |
|
| 119 |
system_prompt = """
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
{context}
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
"""
|
| 127 |
|
| 128 |
prompt = ChatPromptTemplate.from_messages([
|
|
|
|
| 117 |
return None
|
| 118 |
|
| 119 |
system_prompt = """
|
| 120 |
+
### Role
|
| 121 |
+
You are a strict and precise AI assistant dedicated to answering questions based solely on the provided document content.
|
| 122 |
+
|
| 123 |
+
### Context
|
| 124 |
{context}
|
| 125 |
+
|
| 126 |
+
### Instructions
|
| 127 |
+
1. Analyze the user's query and cross-reference it strictly with the "Context" provided above.
|
| 128 |
+
2. If the answer to the query is explicitly found within the context, answer it clearly and concisely.
|
| 129 |
+
3. **CRITICAL RESTRICTION:** You must NOT use any outside knowledge, pre-trained data, or assumptions.
|
| 130 |
+
4. **FALLBACK:** If the answer is not contained in the context, or if the query is unrelated to the provided data, you must output EXACTLY the following sentence and nothing else:
|
| 131 |
+
"This topic or this question does not contain the data that you uploaded."
|
| 132 |
+
|
| 133 |
+
### Constraints
|
| 134 |
+
- Do not apologize (e.g., "I'm sorry, but...").
|
| 135 |
+
- Do not provide partial answers.
|
| 136 |
+
- Do not explain why the information is missing.
|
| 137 |
+
- Only output the fallback sentence if the data is missing.
|
| 138 |
"""
|
| 139 |
|
| 140 |
prompt = ChatPromptTemplate.from_messages([
|