sniro23 commited on
Commit
72e11ad
Β·
1 Parent(s): f0cde84

Fix: Final citation and performance enhancements

Browse files
Files changed (2) hide show
  1. app.py +2 -7
  2. 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 clarity
92
  for i, source in enumerate(response.sources, 1):
93
- # Ensure we don't list more sources than were used for citations
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
- "β€’ Include relevant citations [1], [2] naturally within your response\n"
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