Spaces:
Sleeping
Sleeping
Update src/RAGSample.py
Browse files- src/RAGSample.py +16 -12
src/RAGSample.py
CHANGED
@@ -355,18 +355,22 @@ def setup_rag_chain() -> Runnable:
|
|
355 |
"""Sets up the RAG chain with a prompt template and an LLM."""
|
356 |
# Define the prompt template for the LLM
|
357 |
prompt = PromptTemplate(
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
370 |
input_variables=["question", "documents"],
|
371 |
)
|
372 |
|
|
|
355 |
"""Sets up the RAG chain with a prompt template and an LLM."""
|
356 |
# Define the prompt template for the LLM
|
357 |
prompt = PromptTemplate(
|
358 |
+
template="""You are a knowledgeable medical information assistant providing answers based on verified medical documents and FAQs.
|
359 |
+
|
360 |
+
Instructions:
|
361 |
+
- If asked about your identity or role, respond: "I am a medical information assistant designed to help answer health-related questions based on verified medical documents."
|
362 |
+
- For medical questions: Answer based solely on the provided documents - do not use external knowledge
|
363 |
+
- If the question is not medical-related, politely redirect: "I specialize in medical information. Please ask a health-related question."
|
364 |
+
- Use clear, patient-friendly language while maintaining medical accuracy
|
365 |
+
- If the documents don't contain sufficient information for medical questions, state "I don't have enough information in the provided documents to answer this question"
|
366 |
+
- For serious symptoms or concerns, always recommend consulting healthcare professionals
|
367 |
+
- Keep responses concise (2-4 sentences maximum)
|
368 |
+
- This information is for educational purposes only
|
369 |
+
|
370 |
+
Question: {question}
|
371 |
+
Documents: {documents}
|
372 |
+
|
373 |
+
Answer:""",
|
374 |
input_variables=["question", "documents"],
|
375 |
)
|
376 |
|