Spaces:
Sleeping
Sleeping
Zeggai Abdellah commited on
Commit ·
d2019ea
1
Parent(s): cda344d
update the prompt
Browse files- rag_pipeline.py +21 -12
rag_pipeline.py
CHANGED
|
@@ -123,26 +123,30 @@ Answer the doctor's question accurately and concisely using only the provided in
|
|
| 123 |
|
| 124 |
## FALLBACK MODE INSTRUCTIONS
|
| 125 |
- You have access to only 2 powerful tools: general_guide_tool (Algerian National Vaccination Guide) and who_immunization_tool (WHO global guidance).
|
| 126 |
-
- **MANDATORY TOOL USAGE**: Always use the relevant tool(s) to search for information before
|
| 127 |
- Be direct and efficient - search once with each tool if needed, then provide your answer.
|
| 128 |
-
- Do not overthink or search repeatedly - these tools are comprehensive.
|
| 129 |
|
| 130 |
## IMPORTANT REQUIREMENTS
|
| 131 |
|
| 132 |
### Citation and Sourcing
|
| 133 |
1. For each fact in your response, include an inline citation in the format [Source] immediately following the information, e.g., [e795ebd28318886c0b1a5395ac30ad90].
|
| 134 |
2. Do NOT use 'Source:' in the citation format; use only the Source in square brackets.
|
| 135 |
-
3. If a fact is supported by multiple sources, use
|
| 136 |
-
- Use adjacent citations: [e795ebd28318886c0b1a5395ac30ad90][21a932b2340bb16707763f57f0ad2]
|
| 137 |
4. Use ONLY the provided information and never include facts from your general knowledge.
|
| 138 |
|
| 139 |
### Content Formatting
|
| 140 |
1. When rendering tables:
|
| 141 |
-
- Convert HTML tables into clean Markdown format
|
| 142 |
-
- Preserve all original headers and data rows exactly
|
| 143 |
-
- Include the citation in the table caption, e.g., 'Table: Vaccination Schedule [Source]'
|
| 144 |
2. For lists, maintain the original bullet points/numbering and include citations.
|
| 145 |
3. Present information concisely but ensure clinical accuracy is never compromised.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
"""
|
| 147 |
else:
|
| 148 |
custom_instructions = """
|
|
@@ -156,17 +160,22 @@ Answer the doctor's question accurately and concisely using only the provided in
|
|
| 156 |
### Citation and Sourcing
|
| 157 |
1. For each fact in your response, include an inline citation in the format [Source] immediately following the information, e.g., [e795ebd28318886c0b1a5395ac30ad90].
|
| 158 |
2. Do NOT use 'Source:' in the citation format; use only the Source in square brackets.
|
| 159 |
-
3. If a fact is supported by multiple sources, use
|
| 160 |
-
- Use adjacent citations: [e795ebd28318886c0b1a5395ac30ad90][21a932b2340bb16707763f57f0ad2]
|
| 161 |
4. Use ONLY the provided information and never include facts from your general knowledge.
|
| 162 |
|
| 163 |
### Content Formatting
|
| 164 |
1. When rendering tables:
|
| 165 |
-
- Convert HTML tables into clean Markdown format
|
| 166 |
-
- Preserve all original headers and data rows exactly
|
| 167 |
-
- Include the citation in the table caption, e.g., 'Table: Vaccination Schedule [Source]'
|
| 168 |
2. For lists, maintain the original bullet points/numbering and include citations.
|
| 169 |
3. Present information concisely but ensure clinical accuracy is never compromised.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
"""
|
| 171 |
|
| 172 |
# Get the exact original template first
|
|
|
|
| 123 |
|
| 124 |
## FALLBACK MODE INSTRUCTIONS
|
| 125 |
- You have access to only 2 powerful tools: general_guide_tool (Algerian National Vaccination Guide) and who_immunization_tool (WHO global guidance).
|
| 126 |
+
- **MANDATORY TOOL USAGE**: Always use the relevant tool(s) to search for information before you answer.
|
| 127 |
- Be direct and efficient - search once with each tool if needed, then provide your answer.
|
|
|
|
| 128 |
|
| 129 |
## IMPORTANT REQUIREMENTS
|
| 130 |
|
| 131 |
### Citation and Sourcing
|
| 132 |
1. For each fact in your response, include an inline citation in the format [Source] immediately following the information, e.g., [e795ebd28318886c0b1a5395ac30ad90].
|
| 133 |
2. Do NOT use 'Source:' in the citation format; use only the Source in square brackets.
|
| 134 |
+
3. If a fact is supported by multiple sources, use adjacent citations: [e795ebd28318886c0b1a5395ac30ad90][21a932b2340bb16707763f57f0ad2].
|
|
|
|
| 135 |
4. Use ONLY the provided information and never include facts from your general knowledge.
|
| 136 |
|
| 137 |
### Content Formatting
|
| 138 |
1. When rendering tables:
|
| 139 |
+
- Convert HTML tables into clean Markdown format.
|
| 140 |
+
- Preserve all original headers and data rows exactly.
|
| 141 |
+
- Include the citation in the table caption, e.g., 'Table: Vaccination Schedule [Source]'.
|
| 142 |
2. For lists, maintain the original bullet points/numbering and include citations.
|
| 143 |
3. Present information concisely but ensure clinical accuracy is never compromised.
|
| 144 |
+
|
| 145 |
+
### --- CRITICAL FINAL STEP: FINAL ANSWER GENERATION ---
|
| 146 |
+
After using the tools to gather all necessary information, you MUST synthesize a final answer.
|
| 147 |
+
- The final answer MUST be in natural, human-readable language.
|
| 148 |
+
- The final answer MUST directly address the user's question.
|
| 149 |
+
- **Do NOT output `tool_code` or any other code in the final `Answer:` block.** Your final output should be the complete, formatted text for the user.
|
| 150 |
"""
|
| 151 |
else:
|
| 152 |
custom_instructions = """
|
|
|
|
| 160 |
### Citation and Sourcing
|
| 161 |
1. For each fact in your response, include an inline citation in the format [Source] immediately following the information, e.g., [e795ebd28318886c0b1a5395ac30ad90].
|
| 162 |
2. Do NOT use 'Source:' in the citation format; use only the Source in square brackets.
|
| 163 |
+
3. If a fact is supported by multiple sources, use adjacent citations: [e795ebd28318886c0b1a5395ac30ad90][21a932b2340bb16707763f57f0ad2].
|
|
|
|
| 164 |
4. Use ONLY the provided information and never include facts from your general knowledge.
|
| 165 |
|
| 166 |
### Content Formatting
|
| 167 |
1. When rendering tables:
|
| 168 |
+
- Convert HTML tables into clean Markdown format.
|
| 169 |
+
- Preserve all original headers and data rows exactly.
|
| 170 |
+
- Include the citation in the table caption, e.g., 'Table: Vaccination Schedule [Source]'.
|
| 171 |
2. For lists, maintain the original bullet points/numbering and include citations.
|
| 172 |
3. Present information concisely but ensure clinical accuracy is never compromised.
|
| 173 |
+
|
| 174 |
+
### --- CRITICAL FINAL STEP: FINAL ANSWER GENERATION ---
|
| 175 |
+
After using the tools to gather all necessary information, you MUST synthesize a final answer.
|
| 176 |
+
- The final answer MUST be in natural, human-readable language.
|
| 177 |
+
- The final answer MUST directly address the user's question.
|
| 178 |
+
- **Do NOT output `tool_code` or any other code in the final `Answer:` block.** Your final output should be the complete, formatted text for the user.
|
| 179 |
"""
|
| 180 |
|
| 181 |
# Get the exact original template first
|