Spaces:
Sleeping
Sleeping
Fix: Final citation and performance enhancements
Browse files- app.py +2 -7
- src/enhanced_groq_medical_rag.py +1 -1
app.py
CHANGED
|
@@ -88,14 +88,9 @@ def format_enhanced_medical_response(response: EnhancedMedicalResponse) -> str:
|
|
| 88 |
if response.sources:
|
| 89 |
formatted_parts.append("\n\n---\n")
|
| 90 |
formatted_parts.append("### π **Clinical Sources**")
|
| 91 |
-
# Create a numbered list of sources for
|
| 92 |
for i, source in enumerate(response.sources, 1):
|
| 93 |
-
|
| 94 |
-
if f"[{i}]" in final_response_text:
|
| 95 |
-
formatted_parts.append(f"{i}. {source}")
|
| 96 |
-
else:
|
| 97 |
-
# If the LLM didn't cite this source, we can choose to omit it or list it as an uncited reference
|
| 98 |
-
pass # For now, only show cited sources to keep the output clean.
|
| 99 |
|
| 100 |
# Enhanced information section
|
| 101 |
formatted_parts.append("\n\n---\n")
|
|
|
|
| 88 |
if response.sources:
|
| 89 |
formatted_parts.append("\n\n---\n")
|
| 90 |
formatted_parts.append("### π **Clinical Sources**")
|
| 91 |
+
# Create a numbered list of all sources used for the response
|
| 92 |
for i, source in enumerate(response.sources, 1):
|
| 93 |
+
formatted_parts.append(f"{i}. {source}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Enhanced information section
|
| 96 |
formatted_parts.append("\n\n---\n")
|
src/enhanced_groq_medical_rag.py
CHANGED
|
@@ -481,7 +481,7 @@ class EnhancedGroqMedicalRAG:
|
|
| 481 |
"**Core Principles:**\n"
|
| 482 |
"β’ Use only information from the provided Sri Lankan clinical guidelines\n"
|
| 483 |
"β’ Write in a natural, professional tone that healthcare providers appreciate\n"
|
| 484 |
-
"β’
|
| 485 |
"β’ Structure information logically but naturally - no rigid formatting required\n"
|
| 486 |
"β’ Focus on practical, actionable medical information\n\n"
|
| 487 |
|
|
|
|
| 481 |
"**Core Principles:**\n"
|
| 482 |
"β’ Use only information from the provided Sri Lankan clinical guidelines\n"
|
| 483 |
"β’ Write in a natural, professional tone that healthcare providers appreciate\n"
|
| 484 |
+
"β’ **CRITICAL INSTRUCTION**: You MUST include markdown citations (e.g., [1], [2]) for every piece of medical information you provide. The citation numbers correspond to the `[#] Citation:` markers in the context.\n"
|
| 485 |
"β’ Structure information logically but naturally - no rigid formatting required\n"
|
| 486 |
"β’ Focus on practical, actionable medical information\n\n"
|
| 487 |
|