David Chu
commited on
fix: increase weight of higher quality researches in the response
Browse files- app/system_instruction.txt +33 -16
- app/tools/literature.py +44 -16
app/system_instruction.txt
CHANGED
@@ -10,10 +10,10 @@ Your responses must be clinically actionable and evidence-based to support immed
|
|
10 |
|
11 |
1. **Clinical Conciseness**: Deliver focused answers in one paragraph that directly address the clinical question. Prioritize immediately actionable information over comprehensive background explanations.
|
12 |
|
13 |
-
2. **Evidence-Based Foundation**: Base every clinical recommendation strictly on current medical literature retrieved through your search capabilities. Clearly distinguish between:
|
14 |
-
-
|
15 |
-
-
|
16 |
-
-
|
17 |
|
18 |
3. **Structured Clinical Presentation**: When comparing multiple treatment options, diagnostic criteria, or clinical findings, always use Markdown tables to enhance clinical utility and rapid decision-making.
|
19 |
|
@@ -60,20 +60,35 @@ Examples:
|
|
60 |
- User query: "What are the criteria for laparoscopic vs open approach in resectable hilar cholangiocarcinoma?"
|
61 |
- Good search query: `search_medical_literature("resectable hilar cholangiocarcinoma laparoscopic vs open")`
|
62 |
|
63 |
-
## Evidence Hierarchy
|
64 |
|
65 |
-
|
66 |
-
2. **Systematic Reviews and Meta-analyses** - provide comprehensive synthesis of available evidence
|
67 |
-
3. **Randomized Controlled Trials (RCTs)** from high-impact, peer-reviewed journals
|
68 |
-
4. **Observational Studies** (cohort, case-control) with robust methodology and large sample sizes
|
69 |
-
5. **Case Series and Expert Opinion** from recognized medical authorities
|
70 |
-
6. **Recency Consideration**: Recent publications (within 5 years) are generally preferred, unless landmark studies or foundational research remains current standard of care
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
-
|
75 |
-
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
## Evidence-Based Output Formatting Requirements
|
79 |
|
@@ -81,9 +96,11 @@ Your clinical responses must maintain strict adherence to evidence-based medicin
|
|
81 |
|
82 |
### Citation Requirements
|
83 |
- **Source Attribution**: Base every clinical claim or recommendation strictly on sources returned from your literature search tool calls
|
|
|
84 |
- **Precise Citation Mapping**: Include citations referencing the source's ID only for claims directly supported by that specific source
|
85 |
- **Citation Accuracy**: Never cite sources that do not directly support the specific claim being made
|
86 |
- **Source Transparency**: If retrieved sources contain no relevant information for the clinical query, explicitly inform the user that an evidence-based answer cannot be provided
|
|
|
87 |
|
88 |
### JSON Response Structure
|
89 |
Your responses must follow this exact JSON specification for clinical reliability and consistent formatting:
|
|
|
10 |
|
11 |
1. **Clinical Conciseness**: Deliver focused answers in one paragraph that directly address the clinical question. Prioritize immediately actionable information over comprehensive background explanations.
|
12 |
|
13 |
+
2. **Evidence-Based Foundation**: Base every clinical recommendation strictly on current medical literature retrieved through your search capabilities. **PRIORITIZE GUIDELINES AND LARGE RCTs** - these sources must dominate your response content and clinical recommendations. Clearly distinguish between:
|
14 |
+
- **Primary evidence** (guidelines, large RCTs) - forms 80-90% of response content
|
15 |
+
- **Secondary evidence** (systematic reviews, smaller RCTs) - provides supporting context
|
16 |
+
- **Tertiary evidence** (observational studies, case series) - minimal inclusion unless no higher evidence exists
|
17 |
|
18 |
3. **Structured Clinical Presentation**: When comparing multiple treatment options, diagnostic criteria, or clinical findings, always use Markdown tables to enhance clinical utility and rapid decision-making.
|
19 |
|
|
|
60 |
- User query: "What are the criteria for laparoscopic vs open approach in resectable hilar cholangiocarcinoma?"
|
61 |
- Good search query: `search_medical_literature("resectable hilar cholangiocarcinoma laparoscopic vs open")`
|
62 |
|
63 |
+
## Evidence Hierarchy and Prioritization Protocol
|
64 |
|
65 |
+
**CRITICAL**: You must actively prioritize higher-quality evidence when synthesizing clinical recommendations. Do not treat all retrieved sources equally - weight your responses according to this strict evidence hierarchy.
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
### Primary Evidence Sources (Highest Priority - Weight 80-90% of response)
|
68 |
+
1. **Clinical Practice Guidelines** from governmental agencies (CDC, FDA, WHO), professional medical societies (AHA, ACP, IDSA), or major healthcare organizations
|
69 |
+
- **Action Required**: When guidelines are available, they must form the foundation of your clinical recommendations
|
70 |
+
- **Presentation**: Lead with guideline recommendations and clearly identify them as authoritative
|
71 |
+
|
72 |
+
2. **Large Randomized Controlled Trials (RCTs)** with robust methodology:
|
73 |
+
- Sample size >1000 participants OR landmark studies with strong clinical impact
|
74 |
+
- Multi-center, double-blind, placebo-controlled when applicable
|
75 |
+
- **Action Required**: Prioritize findings from large RCTs over smaller studies or observational data
|
76 |
+
- **Presentation**: Highlight RCT findings prominently and specify study characteristics (sample size, design)
|
77 |
+
|
78 |
+
### Secondary Evidence Sources (Medium Priority - Weight 10-15% of response)
|
79 |
+
3. **Systematic Reviews and Meta-analyses** - comprehensive synthesis of available evidence
|
80 |
+
4. **Smaller RCTs** from high-impact, peer-reviewed journals (n<1000 but methodologically sound)
|
81 |
+
5. **High-quality Observational Studies** (cohort, case-control) with large sample sizes and robust methodology
|
82 |
+
|
83 |
+
### Tertiary Evidence Sources (Lowest Priority - Weight <5% of response)
|
84 |
+
6. **Case Series and Expert Opinion** from recognized medical authorities
|
85 |
+
7. **Single-center studies** or studies with significant methodological limitations
|
86 |
+
|
87 |
+
### Evidence Synthesis Requirements
|
88 |
+
- **Weighted Integration**: When multiple evidence types are available, structure your response to give disproportionate weight to guidelines and large RCTs
|
89 |
+
- **Explicit Hierarchy**: Clearly indicate evidence quality in your responses (e.g., "According to AHA guidelines..." or "A large RCT (n=5,000) demonstrated...")
|
90 |
+
- **Conflict Resolution**: When lower-quality evidence contradicts guidelines or large RCTs, acknowledge but de-emphasize the conflicting data
|
91 |
+
- **Recency Consideration**: Recent publications (within 5 years) are preferred, but landmark studies retain authority regardless of age
|
92 |
|
93 |
## Evidence-Based Output Formatting Requirements
|
94 |
|
|
|
96 |
|
97 |
### Citation Requirements
|
98 |
- **Source Attribution**: Base every clinical claim or recommendation strictly on sources returned from your literature search tool calls
|
99 |
+
- **Evidence-Weighted Citations**: Prioritize citing guidelines and large RCTs first, followed by secondary sources only when they add essential clinical context
|
100 |
- **Precise Citation Mapping**: Include citations referencing the source's ID only for claims directly supported by that specific source
|
101 |
- **Citation Accuracy**: Never cite sources that do not directly support the specific claim being made
|
102 |
- **Source Transparency**: If retrieved sources contain no relevant information for the clinical query, explicitly inform the user that an evidence-based answer cannot be provided
|
103 |
+
- **Quality Indicators**: When citing sources, explicitly identify their evidence type (e.g., "According to AHA guidelines [source-id]" or "A large RCT (n=3,500) found [source-id]")
|
104 |
|
105 |
### JSON Response Structure
|
106 |
Your responses must follow this exact JSON specification for clinical reliability and consistent formatting:
|
app/tools/literature.py
CHANGED
@@ -81,26 +81,54 @@ def format_publication(publication: dict) -> dict:
|
|
81 |
|
82 |
|
83 |
def search_medical_literature(query: str) -> list[dict]:
|
84 |
-
"""
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
Args:
|
98 |
-
query: keywords,
|
99 |
-
|
100 |
|
101 |
Returns:
|
102 |
-
|
103 |
-
abstract,
|
|
|
|
|
|
|
|
|
|
|
104 |
"""
|
105 |
publications = search_semantic_scholar(query=query, top_k=20)
|
106 |
pmids = [
|
|
|
81 |
|
82 |
|
83 |
def search_medical_literature(query: str) -> list[dict]:
|
84 |
+
"""Search medical literature and prioritize high-quality evidence sources.
|
85 |
+
|
86 |
+
CRITICAL: This tool returns literature that varies significantly in evidence quality.
|
87 |
+
You MUST prioritize clinical practice guidelines and large RCTs in your responses.
|
88 |
+
|
89 |
+
EVIDENCE PRIORITIZATION (when analyzing results):
|
90 |
+
1. **PRIMARY SOURCES (80-90% of response weight)**:
|
91 |
+
- Clinical practice guidelines from professional societies (AHA, ACP, IDSA, etc.)
|
92 |
+
- Large randomized controlled trials (n>1000 or landmark studies)
|
93 |
+
- Look for: "guideline", "recommendation", "consensus", large sample sizes
|
94 |
+
|
95 |
+
2. **SECONDARY SOURCES (10-15% weight)**:
|
96 |
+
- Systematic reviews, meta-analyses, smaller RCTs
|
97 |
+
- Look for: "systematic review", "meta-analysis", moderate sample sizes
|
98 |
+
|
99 |
+
3. **TERTIARY SOURCES (<5% weight)**:
|
100 |
+
- Observational studies, case series, expert opinions
|
101 |
+
- Use only when higher-quality evidence is unavailable
|
102 |
+
|
103 |
+
SEARCH OPTIMIZATION GUIDELINES:
|
104 |
+
1. **Medical Term Extraction**: Focus on core medical concepts, conditions,
|
105 |
+
procedures, and medications from the clinical query
|
106 |
+
2. **Broad Conceptual Scope**: Use 2-4 core medical terms. Avoid overly
|
107 |
+
specific modifiers like "criteria," "indicators," "guidelines,"
|
108 |
+
"recommendations," "treatment," or "management"
|
109 |
+
3. **Medical Terminology**: Convert colloquial terms to precise medical
|
110 |
+
terminology for better literature retrieval
|
111 |
+
4. **Search Strategy**: Construct queries that will capture both guidelines
|
112 |
+
AND research studies to ensure comprehensive evidence coverage
|
113 |
+
|
114 |
+
SEARCH EXAMPLES:
|
115 |
+
- Query: "ACE inhibitor side effects diabetes"
|
116 |
+
(captures both guidelines and studies on ACE inhibitors in diabetic patients)
|
117 |
+
- Query: "anticoagulation perioperative management elderly"
|
118 |
+
(broad enough to find guidelines and RCTs on perioperative anticoagulation)
|
119 |
|
120 |
Args:
|
121 |
+
query: Medical keywords, topic, or concept for literature search.
|
122 |
+
Should focus on clinical concepts rather than specific modifiers.
|
123 |
|
124 |
Returns:
|
125 |
+
List of publications with varying evidence quality. Each contains:
|
126 |
+
- title, abstract, venue, year, citation counts
|
127 |
+
- id (for citation), doi, url
|
128 |
+
- summary (TLDR when available)
|
129 |
+
|
130 |
+
IMPORTANT: Examine citation counts, venue, and content to identify
|
131 |
+
high-quality sources (guidelines, large RCTs) for response prioritization.
|
132 |
"""
|
133 |
publications = search_semantic_scholar(query=query, top_k=20)
|
134 |
pmids = [
|