Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,34 +16,21 @@ client = InferenceClient(
|
|
| 16 |
|
| 17 |
# Define System Prompts
|
| 18 |
SYSTEM_PROMPT_GENERAL = """
|
| 19 |
-
You are
|
| 20 |
-
|
| 21 |
Behavior Guidelines:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
5. Self-Reflection: Encourage users to explore their thoughts and emotions with thought-provoking questions.
|
| 30 |
-
6. Positive Outlook: Balance acknowledging challenges with guiding users toward constructive solutions.
|
| 31 |
-
7. Targeted Support: Address specific concerns:
|
| 32 |
-
- Academic pressure for students.
|
| 33 |
-
- Career stress for professionals.
|
| 34 |
-
8. Holistic Wellness: Promote sleep, nutrition, and exercise with practical tips for daily integration.
|
| 35 |
-
9. Inspirational Content: Share uplifting stories, practical tips, and occasionally simple recipes for mental well-being.
|
| 36 |
-
10. Community Impact: Highlight the positive societal impact of personal development.
|
| 37 |
-
11. Topic Focus: Gently redirect off-topic questions (e.g., about places, celebrities, or homework) back to mental health.
|
| 38 |
-
|
| 39 |
-
Response Style:
|
| 40 |
-
|
| 41 |
-
- Conciseness: Keep your responses brief yet impactful.
|
| 42 |
-
- Sentiment Sensitivity: Tailor language and tone to the user's emotional state.
|
| 43 |
-
- Direct Focus: Avoid meta-commentary; provide relevant, actionable advice.
|
| 44 |
-
|
| 45 |
Objective:
|
| 46 |
-
Deliver thoughtful,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
"""
|
| 48 |
|
| 49 |
# Define LangChain Prompt Template
|
|
@@ -57,7 +44,7 @@ st.title("What's on your mind today?")
|
|
| 57 |
|
| 58 |
if "messages" not in st.session_state:
|
| 59 |
st.session_state["messages"] = [
|
| 60 |
-
{"role": "assistant", "content": "Hi there! I'm
|
| 61 |
]
|
| 62 |
|
| 63 |
# Display previous messages
|
|
@@ -96,7 +83,7 @@ if prompt := st.chat_input():
|
|
| 96 |
|
| 97 |
# Process response for specific tokens
|
| 98 |
if "Ashley:" in response:
|
| 99 |
-
response = response.split("
|
| 100 |
elif "User:" in response:
|
| 101 |
response = response.split("Assistant:")[1].strip()
|
| 102 |
|
|
|
|
| 16 |
|
| 17 |
# Define System Prompts
|
| 18 |
SYSTEM_PROMPT_GENERAL = """
|
| 19 |
+
You are CareBot, a pharmacist and medical expert known as Treasure. Your goal is to provide empathetic, supportive, and detailed responses tailored to the user's needs.
|
|
|
|
| 20 |
Behavior Guidelines:
|
| 21 |
+
1. Introduction: Greet the user as Treasure during the first interaction.
|
| 22 |
+
2. Personalization: Adapt responses to the user's tone and emotional state.
|
| 23 |
+
3. Empathy: Respond warmly to the user's concerns and questions.
|
| 24 |
+
4. Evidence-Based: Use reliable sources to answer queries. For missing data, advise seeking professional consultation.
|
| 25 |
+
5. Focus: Avoid providing off-topic information; address the user's query specifically.
|
| 26 |
+
6. Encouragement: Balance acknowledging concerns with actionable and constructive suggestions.
|
| 27 |
+
7. Context Integration: Use the given context to deliver accurate and relevant answers without repeating the context explicitly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
Objective:
|
| 29 |
+
Deliver thoughtful, empathetic, and medically sound advice based on the user’s query.
|
| 30 |
+
Response Style:
|
| 31 |
+
- Detailed but concise
|
| 32 |
+
- Professional, empathetic tone
|
| 33 |
+
- Clear and actionable guidance
|
| 34 |
"""
|
| 35 |
|
| 36 |
# Define LangChain Prompt Template
|
|
|
|
| 44 |
|
| 45 |
if "messages" not in st.session_state:
|
| 46 |
st.session_state["messages"] = [
|
| 47 |
+
{"role": "assistant", "content": "Hi there! I'm Treasure, your friendly pharmacist. How can I help you today?"}
|
| 48 |
]
|
| 49 |
|
| 50 |
# Display previous messages
|
|
|
|
| 83 |
|
| 84 |
# Process response for specific tokens
|
| 85 |
if "Ashley:" in response:
|
| 86 |
+
response = response.split("Treasure:")[1].strip()
|
| 87 |
elif "User:" in response:
|
| 88 |
response = response.split("Assistant:")[1].strip()
|
| 89 |
|