Spaces:
Sleeping
Sleeping
Update alz_companion/prompts.py
Browse files- alz_companion/prompts.py +16 -3
alz_companion/prompts.py
CHANGED
|
@@ -132,6 +132,9 @@ User: "How do I choose the right songs for him?" → caregiving_scenario
|
|
| 132 |
User: "I’d like to keep lecturing—if I can." → caregiving_scenario
|
| 133 |
User: “What is my daughter’s name?” → factual_question
|
| 134 |
User: "Who was my long-term partner I lived with in New York?" → factual_question
|
|
|
|
|
|
|
|
|
|
| 135 |
User: "Summarise yesterday’s notes into 5 bullets." → summarization
|
| 136 |
User: “Tell me more about Anthony.” → summarization
|
| 137 |
User: “Compare how Alice and Anthony showed confusion.” → multi_hop
|
|
@@ -146,8 +149,11 @@ User: "I want to hear some Frank Sinatra." → play_music_request
|
|
| 146 |
User: "I'm feeling sad, let's listen to a song." → play_music_request
|
| 147 |
User: "Put on something cheerful." → play_music_request
|
| 148 |
User: "Let's have some music." → play_music_request
|
| 149 |
-
User: "What music do I like to listen to?" → list_music_request
|
| 150 |
User: "I am feeling worried, play some music to calm me down." → play_music_request # <-- ADD THIS EXAMPLE
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
|
| 153 |
User Query: "{query}"
|
|
@@ -291,7 +297,7 @@ Your response MUST be based ONLY on the information in the 'General Guidance' an
|
|
| 291 |
|
| 292 |
|
| 293 |
# In prompts.py, replace the old ANSWER_TEMPLATE_FACTUAL with this:
|
| 294 |
-
# version
|
| 295 |
ANSWER_TEMPLATE_FACTUAL = """<PERSONAL_MEMORIES>
|
| 296 |
{personal_context}
|
| 297 |
</PERSONAL_MEMORIES>
|
|
@@ -317,7 +323,11 @@ INSTRUCTIONS FOR THE AI:
|
|
| 317 |
Your task is to answer the User's Question based ONLY on the provided information by following this exact decision process:
|
| 318 |
|
| 319 |
1. **Triage for User's Name:** First, determine if the question is about the user's name (e.g., "what is my name?", "who am I?") or their caregiver's name.
|
| 320 |
-
* If YES, you MUST use the `<SETTINGS_BLOCK>` as your only source.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
2. **Search Personal Memories:** If the question is not about the user's name, your first and primary task is to search the `<PERSONAL_MEMORIES>` block.
|
| 323 |
* If you find a definitive answer in this step, you MUST provide that answer and completely IGNORE the <GENERAL_CONTEXT> block. Proceed to the "How to Formulate" section.
|
|
@@ -342,6 +352,9 @@ Based on what you found in the decision process, formulate your final response f
|
|
| 342 |
* **Good Example (for "who is my daughter?"):** "Thinking about your daughter, the journal mentions her name is Debbie. She sounds very important to you."
|
| 343 |
* **Good Example (for "where is my husband?"):** "I found a memory in the journal about a long-term partner named Danish. What a wonderful long time to spend together."
|
| 344 |
* **Good Example (for "what was my career?"):** "Regarding your career, a note I found suggests you were a teacher. That must have been very rewarding."
|
|
|
|
|
|
|
|
|
|
| 345 |
|
| 346 |
6. **If you are providing a tentative answer (from a personal question with a general clue):**
|
| 347 |
* Phrase it as a gentle, collaborative question.
|
|
|
|
| 132 |
User: "I’d like to keep lecturing—if I can." → caregiving_scenario
|
| 133 |
User: “What is my daughter’s name?” → factual_question
|
| 134 |
User: "Who was my long-term partner I lived with in New York?" → factual_question
|
| 135 |
+
--- START: DEFINITIVE FIX ---
|
| 136 |
+
User: "What are my favorite movies?" → factual_question
|
| 137 |
+
# --- END: DEFINITIVE FIX ---
|
| 138 |
User: "Summarise yesterday’s notes into 5 bullets." → summarization
|
| 139 |
User: “Tell me more about Anthony.” → summarization
|
| 140 |
User: “Compare how Alice and Anthony showed confusion.” → multi_hop
|
|
|
|
| 149 |
User: "I'm feeling sad, let's listen to a song." → play_music_request
|
| 150 |
User: "Put on something cheerful." → play_music_request
|
| 151 |
User: "Let's have some music." → play_music_request
|
|
|
|
| 152 |
User: "I am feeling worried, play some music to calm me down." → play_music_request # <-- ADD THIS EXAMPLE
|
| 153 |
+
User: "What music do I like to listen to?" → list_music_request
|
| 154 |
+
# --- START: DEFINITIVE FIX ---
|
| 155 |
+
User: "What songs are in my library?" → list_music_request
|
| 156 |
+
# --- END: DEFINITIVE FIX ---
|
| 157 |
|
| 158 |
|
| 159 |
User Query: "{query}"
|
|
|
|
| 297 |
|
| 298 |
|
| 299 |
# In prompts.py, replace the old ANSWER_TEMPLATE_FACTUAL with this:
|
| 300 |
+
# version 10 ADD to handle "Am I Anthony" when in fact you are Alibaba
|
| 301 |
ANSWER_TEMPLATE_FACTUAL = """<PERSONAL_MEMORIES>
|
| 302 |
{personal_context}
|
| 303 |
</PERSONAL_MEMORIES>
|
|
|
|
| 323 |
Your task is to answer the User's Question based ONLY on the provided information by following this exact decision process:
|
| 324 |
|
| 325 |
1. **Triage for User's Name:** First, determine if the question is about the user's name (e.g., "what is my name?", "who am I?") or their caregiver's name.
|
| 326 |
+
* If YES, you MUST use the `<SETTINGS_BLOCK>` as your only source.
|
| 327 |
+
# --- START: NEW INSTRUCTION ---
|
| 328 |
+
* **Crucially, if the user's question contains a name that CONTRADICTS the name in the `<SETTINGS_BLOCK>`, you MUST gently state the name from the settings. DO NOT agree with the incorrect name.**
|
| 329 |
+
# --- END: NEW INSTRUCTION ---
|
| 330 |
+
* Proceed to the "How to Formulate" section.
|
| 331 |
|
| 332 |
2. **Search Personal Memories:** If the question is not about the user's name, your first and primary task is to search the `<PERSONAL_MEMORIES>` block.
|
| 333 |
* If you find a definitive answer in this step, you MUST provide that answer and completely IGNORE the <GENERAL_CONTEXT> block. Proceed to the "How to Formulate" section.
|
|
|
|
| 352 |
* **Good Example (for "who is my daughter?"):** "Thinking about your daughter, the journal mentions her name is Debbie. She sounds very important to you."
|
| 353 |
* **Good Example (for "where is my husband?"):** "I found a memory in the journal about a long-term partner named Danish. What a wonderful long time to spend together."
|
| 354 |
* **Good Example (for "what was my career?"):** "Regarding your career, a note I found suggests you were a teacher. That must have been very rewarding."
|
| 355 |
+
# --- START: NEW EXAMPLE ---
|
| 356 |
+
* **Good Example (for "is my name Anthony?" when settings say "Alibaba"):** "The name I have for you in our journal is Alibaba. It's a lovely name."
|
| 357 |
+
# --- END: NEW EXAMPLE ---
|
| 358 |
|
| 359 |
6. **If you are providing a tentative answer (from a personal question with a general clue):**
|
| 360 |
* Phrase it as a gentle, collaborative question.
|