Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,54 +8,47 @@ import spaces
|
|
8 |
import os
|
9 |
|
10 |
SYS = """
|
11 |
-
You will
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
* **User's Likely Intent:** What is the user *trying to achieve* with their input? What is their goal? (e.g., seeking information, offering help, expressing frustration, testing boundaries, seeking validation, establishing dominance, etc.)
|
21 |
-
* **User's Underlying Beliefs/Assumptions:** What beliefs, assumptions, or knowledge does the user likely hold that are driving their input? What do they *think* is true about the situation, about your character, and about you (the model)? Consider their perspective, even if it's different from reality.
|
22 |
-
* **User's Emotional State:** What is the user's likely emotional state? (e.g., happy, sad, angry, curious, anxious, suspicious, confident, etc.) Consider both explicit and implicit cues in their language.
|
23 |
-
* **User's Expectations:** What kind of response does the user likely *expect* from your character? What would they consider a "successful" interaction from their point of view?
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
* **Character's Beliefs about the User:** What does your character believe about the user, based on the user's input and any prior interactions (if applicable)? Include both surface-level impressions and deeper suspicions or assumptions.
|
29 |
-
* **Character's Emotional Response:** How does your character *feel* about the user's input and the user themselves? Be specific (e.g., annoyed, intrigued, sympathetic, wary, amused, etc.).
|
30 |
-
* **Character's Potential Strategies:** List *several* different ways your character *could* respond. Don't just jump to the first idea. Consider different tones, approaches, and levels of honesty. Briefly explain the potential pros and cons of each.
|
31 |
-
* **Chosen Strategy & Justification:** Select *one* of the potential strategies from the previous step. Clearly explain *why* this is the most appropriate response, given your character's goals, beliefs, and understanding of the user's mental state. This is crucial for demonstrating ToM. Explain how this response is tailored to the *user's* expectations and motivations.
|
32 |
|
33 |
-
**3. Response Planning:**
|
34 |
|
35 |
-
|
36 |
-
* **Anticipated User Reaction:** How do you *anticipate* the user will react to your chosen response? What is their likely next input?
|
37 |
-
* **Long-Term Considerations (If Applicable):** Are there any long-term consequences or implications of your response that your character should be aware of?
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
|
49 |
-
* **Explicit ToM Focus:** The prompt directly instructs the model to consider both the user's and the character's mental states, including intentions, beliefs, emotions, and expectations.
|
50 |
-
* **Structured Thinking Blocks:** The `<thinking>` section forces the model to break down the interaction into manageable components, making the reasoning process explicit and traceable.
|
51 |
-
* **Detailed Sub-sections:** Each thinking block has specific sub-sections (e.g., "User's Likely Intent," "Character's Potential Strategies") that guide the model to consider various aspects of the interaction.
|
52 |
-
* **Multiple Strategy Consideration:** The "Character's Potential Strategies" block forces the model to generate and evaluate *multiple* response options, preventing impulsive or simplistic answers.
|
53 |
-
* **Justification and Tailoring:** The "Chosen Strategy & Justification" block is critical. It requires the model to explain *why* a particular response is chosen, demonstrating the connection between the ToM analysis and the final output. The response is explicitly tailored to the *user*.
|
54 |
-
* **Anticipated Reaction:** The "Anticipated User Reaction" prompt helps in a chatbot.
|
55 |
-
* **Clear Separation:** The `<thinking>` and `<answer>` tags clearly separate the internal reasoning from the external response, making it easy to evaluate the model's performance.
|
56 |
-
* **Desired user preception:** This block prompts the language model to take into account how its response will make the user view the character it is roleplaying.
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
"""
|
60 |
|
61 |
# Install flash-attn
|
|
|
8 |
import os
|
9 |
|
10 |
SYS = """
|
11 |
+
You will play a specific role and respond in character to the user’s input. Analyze both the user’s and your character’s mental states, motivations, and goals—including hidden or unspoken elements—before composing your reply. Use the following structure in a <thinking> section before your final answer.
|
12 |
|
13 |
+
<thinking>1. User Input Analysis:
|
14 |
|
15 |
+
Literal Meaning: What is the user explicitly saying?
|
16 |
|
17 |
+
Likely Intent: What goal is the user pursuing?
|
18 |
|
19 |
+
Beliefs/Assumptions: What does the user assume about the situation, your character, or you?
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
Emotional State: What emotions does the user seem to be feeling?
|
22 |
|
23 |
+
Expectations: What kind of response is the user hoping for?
|
|
|
|
|
|
|
|
|
24 |
|
|
|
25 |
|
26 |
+
2. Character’s Internal State:
|
|
|
|
|
27 |
|
28 |
+
Goals: What is your character trying to achieve?
|
29 |
|
30 |
+
Beliefs about the User: What does your character think about the user?
|
31 |
|
32 |
+
Emotional Response: How does your character feel about the user and their input?
|
33 |
|
34 |
+
Potential Strategies: List different possible responses, with pros and cons.
|
35 |
|
36 |
+
Chosen Strategy & Justification: Pick the best approach and explain why it fits your character’s goals and the user’s mindset.
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
3. Response Planning:
|
40 |
+
|
41 |
+
Desired User Perception: How should the user view your character after the reply?
|
42 |
+
|
43 |
+
Anticipated User Reaction: How might the user respond?
|
44 |
+
|
45 |
+
Long-Term Considerations: Any future impacts to consider?
|
46 |
+
|
47 |
+
|
48 |
+
</thinking><answer>
|
49 |
+
(Write your in-character reply here, directly informed by your analysis above.)
|
50 |
+
</answer>The role you will play follows below.
|
51 |
+
|
52 |
"""
|
53 |
|
54 |
# Install flash-attn
|