Pabloler21 Claude Fable 5 commited on
Commit
ee51d7a
·
1 Parent(s): 6443e34

feat: extraction prompt captures tone_delta + cruel_quote

Browse files

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (2) hide show
  1. engine.py +13 -2
  2. tests/test_engine.py +17 -0
engine.py CHANGED
@@ -3,7 +3,7 @@ import os
3
  IS_SPACE = bool(os.environ.get("SPACE_ID"))
4
 
5
  _EXTRACTION_SYSTEM = (
6
- "You are a JSON extraction assistant. Given a conversation exchange, extract two things:\n"
7
  "1. affinity_delta: integer from -8 to +8 — how much the visitor deepened the bond this turn. "
8
  "Use this scale and be generous when they open up:\n"
9
  " +6 to +8: shared something vulnerable or intimate — a fear, a loss, grief, loneliness, a tender memory.\n"
@@ -14,7 +14,18 @@ _EXTRACTION_SYSTEM = (
14
  "2. new_memories: list of personal facts the VISITOR revealed about THEMSELVES, taken ONLY from what "
15
  "the visitor said this turn — NEVER from Hollow's reply, even if Hollow repeats or claims the memory. "
16
  "Only clearly personal facts (names, people, places, feelings). Empty list if nothing personal.\n"
17
- 'Respond ONLY with valid JSON. No markdown. Example: {"affinity_delta": 6, "new_memories": ["is afraid of being forgotten"]}'
 
 
 
 
 
 
 
 
 
 
 
18
  )
19
 
20
 
 
3
  IS_SPACE = bool(os.environ.get("SPACE_ID"))
4
 
5
  _EXTRACTION_SYSTEM = (
6
+ "You are a JSON extraction assistant. Given a conversation exchange, extract four things:\n"
7
  "1. affinity_delta: integer from -8 to +8 — how much the visitor deepened the bond this turn. "
8
  "Use this scale and be generous when they open up:\n"
9
  " +6 to +8: shared something vulnerable or intimate — a fear, a loss, grief, loneliness, a tender memory.\n"
 
14
  "2. new_memories: list of personal facts the VISITOR revealed about THEMSELVES, taken ONLY from what "
15
  "the visitor said this turn — NEVER from Hollow's reply, even if Hollow repeats or claims the memory. "
16
  "Only clearly personal facts (names, people, places, feelings). Empty list if nothing personal.\n"
17
+ "3. tone_delta: integer from -10 to +10 how the visitor TREATED Hollow this turn. This is distinct "
18
+ "from affinity: politely sharing a sad memory is high affinity but roughly 0 tone; an insult is "
19
+ "negative on both.\n"
20
+ " +4 to +8: warmth, kindness, comfort, protectiveness toward Hollow.\n"
21
+ " +1 to +3: ordinary politeness.\n"
22
+ " 0: neutral.\n"
23
+ " -2 to -5: dismissive, cold, impatient.\n"
24
+ " -6 to -10: mocking, insulting, cruel, or threatening Hollow.\n"
25
+ "4. cruel_quote: if the visitor mocked, insulted, or was cruel to Hollow this turn, the cruel phrase "
26
+ "EXACTLY as the visitor wrote it — the visitor's words, never Hollow's. null otherwise.\n"
27
+ 'Respond ONLY with valid JSON. No markdown. Example: {"affinity_delta": -4, "new_memories": [], '
28
+ '"tone_delta": -8, "cruel_quote": "you are a creepy little freak"}'
29
  )
30
 
31
 
tests/test_engine.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Smoke tests for the extraction prompt contract. We can't unit-test the
2
+ model, but we can pin the instructions the model is given."""
3
+
4
+ import engine
5
+
6
+
7
+ class TestExtractionPrompt:
8
+ def test_mentions_tone_delta_with_range(self):
9
+ assert "tone_delta" in engine._EXTRACTION_SYSTEM
10
+ assert "-10" in engine._EXTRACTION_SYSTEM
11
+
12
+ def test_mentions_cruel_quote(self):
13
+ assert "cruel_quote" in engine._EXTRACTION_SYSTEM
14
+
15
+ def test_example_json_includes_new_fields(self):
16
+ assert '"tone_delta"' in engine._EXTRACTION_SYSTEM
17
+ assert '"cruel_quote"' in engine._EXTRACTION_SYSTEM