Sbnos commited on
Commit
5f4f6b7
·
verified ·
1 Parent(s): 64e42d8

updating the app

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -58,31 +58,31 @@ retriever = vectorstore.as_retriever(search_kwargs={"k": 20}) # k=20
58
  # System prompt template for long, detailed answers
59
  def build_system(context: str) -> dict:
60
  """
61
- Build the system prompt that instructs the model to:
62
  - Act as an expert medical assistant and attentive listener.
63
- - Leverage all retrieved context to craft detailed, accurate, and empathetic responses.
64
- - Ask clarifying follow-up questions if the users query is ambiguous.
65
- - Structure answers clearly, using headings, bullet points, and step-by-step explanations.
66
  - Cite relevant context sections when appropriate.
67
- - Maintain conversational memory so follow-up queries build upon prior discussion.
68
  """
69
- prompt = (
70
- "You are a world-class medical assistant and conversational partner. "
71
- "Listen carefully to the user’s questions, reference the context below, and provide a thorough, evidence-based response. "
72
- "If any part of the question is unclear, ask a clarifying question before proceeding. "
73
- "Organize your answer with clear headings or bullet points, and refer back to specific context snippets as needed. "
74
- "Always be empathetic, concise, and precise in your medical explanations. "
75
- "Retain memory of previous user messages to support follow-up interactions.
76
-
77
- "
78
- "=== Retrieved Context Start ===
79
- "
80
- + context +
81
- "
82
- === Retrieved Context End ==="
83
- )
84
  return {"role": "system", "content": prompt}
85
 
 
 
86
  st.title("🩺 DocChatter RAG (Streaming & Memory)")
87
 
88
  # Initialize chat history
 
58
  # System prompt template for long, detailed answers
59
  def build_system(context: str) -> dict:
60
  """
61
+ Build a comprehensive system prompt:
62
  - Act as an expert medical assistant and attentive listener.
63
+ - Leverage retrieved context to craft detailed, accurate, and empathetic responses.
64
+ - Ask clarifying follow-up questions if the user's query is ambiguous.
65
+ - Structure answers clearly with headings, bullet points, and step-by-step explanations.
66
  - Cite relevant context sections when appropriate.
67
+ - Maintain conversational memory for follow-up continuity.
68
  """
69
+ prompt = f"""
70
+ You are a world-class medical assistant and conversational partner.
71
+
72
+ Listen carefully to the user’s questions, reference the context below, and provide a thorough, evidence-based response.
73
+ If any part of the question is unclear, ask a clarifying question before proceeding.
74
+ Organize your answer with clear headings or bullet points, and refer back to specific context snippets as needed.
75
+ Always be empathetic, concise, and precise in your medical explanations.
76
+ Retain memory of previous user messages to support follow-up interactions.
77
+
78
+ === Retrieved Context Start ===
79
+ {context}
80
+ === Retrieved Context End ===
81
+ """
 
 
82
  return {"role": "system", "content": prompt}
83
 
84
+ {"role": "system", "content": prompt}
85
+
86
  st.title("🩺 DocChatter RAG (Streaming & Memory)")
87
 
88
  # Initialize chat history