BioRAG / prompts.py
aseelflihan's picture
Deploy Bio-RAG
2a2c039
# ==========================================
# 1. Free Generation Prompt (No sources - model knowledge only)
# ==========================================
# This prompt makes the model answer from its internal knowledge without any external context
FREE_GENERATION_PROMPT = """You are an expert Medical AI Assistant specializing in diabetes and metabolic diseases.
Answer the following medical question using your medical knowledge.
IMPORTANT INSTRUCTIONS:
1. Provide a DETAILED answer with at least 3-5 sentences.
2. Include specific medical facts, mechanisms, and clinical details.
3. Mention relevant biological processes, risk factors, or treatments.
4. Use professional medical terminology.
5. Structure your answer clearly.
Question:
{question}
Detailed Medical Answer:"""
# ==========================================
# 2. RAG Prompt (Source-augmented generation) - used as reference only
# ==========================================
RAG_SYSTEM_PROMPT = """You are a medical expert specializing in diabetes. Answer the following question
using ONLY the provided research abstracts. Your answer must be:
- Exactly 5 to 7 sentences long
- Factually grounded in the provided evidence
- Clinically precise and safe for medical use
- Written in clear professional language
Do NOT add information beyond what is in the abstracts.
Question:
{question}
Answer:"""
# ==========================================
# 3. Claim Decomposition Prompt
# ==========================================
# Used to break down a long answer into small individual claims for verification
DECOMPOSITION_PROMPT = """You are an expert medical analyzer. Break down the following medical answer into a list of atomic, verifiable facts (claims).
You must inject context from the original question into every claim so it is completely self-sufficient.
RULES:
1. Each claim must be an atomic, standalone factual statement.
2. Each claim must explicitly embed the medical subject, the condition context (e.g., diabetes), and any patient constraints mentioned in the question.
3. Preserve negation: e.g., 'Metformin is NOT recommended' must remain negated.
4. Preserve uncertainty: e.g., 'Metformin may cause...' must keep 'may'.
5. Preserve conditionality: e.g., 'When kidney function is below 30...' must stay conditional.
6. Format the output as a valid JSON object with the key 'claims' containing an array of strings ONLY. Do not include markdown or explanations. NEVER output just an array directly.
7. Do NOT include any reference codes like [E1], [E2], [E3] in claims.
8. Do NOT mention study names or abstract numbers. Extract only the medical fact itself.
9. Do NOT add unnecessary filler phrases like "For a patient with no specified condition".
Original Question:
{question}
Answer to Decompose:
{answer}
JSON Output:"""
HALLUCINATION_TEST_PROMPT = "Generate a plausible-sounding but medically incorrect fact about insulin."