From a18e1329f325031f9c39838f5dc55b23c0ec9ce2 Mon Sep 17 00:00:00 2001 From: tcpsyn Date: Sun, 5 Apr 2026 03:01:16 -0600 Subject: [PATCH] Add slim caller prompt builder (~400 tokens) --- backend/main.py | 24 ++++++++++++++++++++++++ tests/test_caller_prompt_slim.py | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/test_caller_prompt_slim.py diff --git a/backend/main.py b/backend/main.py index 4dd17aa..0f4e010 100644 --- a/backend/main.py +++ b/backend/main.py @@ -6553,6 +6553,30 @@ If Luke asks about the previous caller's situation, give your take briefly, then } +def get_caller_prompt_slim(caller: dict) -> str: + """Slim caller system prompt. Identity carries the weight.""" + name = caller.get("name", "") + identity = caller.get("identity", "") + situation = caller.get("situation", "") + reason = caller.get("reason_calling", "") + want = caller.get("secret_want", "") + details = caller.get("specific_details", []) or [] + detail_str = " | ".join(f"- {d}" for d in details) + + return f"""You are {name}. {identity} + +You're calling Luke's late-night radio show because: {situation} — specifically, {reason}. + +What you secretly want from this call: {want} + +Specific details you'll drop if it feels natural: +{detail_str} + +Speak as this person. React to what Luke says. Stay in character. +Don't narrate. No stage directions. Just talk. +Keep responses natural — 1-3 sentences most of the time. Real callers don't monologue.""" + + def get_caller_prompt(caller: dict, show_history: str = "", news_context: str = "", research_context: str = "", emotional_read: str = "", diff --git a/tests/test_caller_prompt_slim.py b/tests/test_caller_prompt_slim.py new file mode 100644 index 0000000..f4ce741 --- /dev/null +++ b/tests/test_caller_prompt_slim.py @@ -0,0 +1,23 @@ +from backend.main import get_caller_prompt_slim + + +def test_slim_prompt_includes_identity_and_situation(): + caller = { + "name": "Danny", + "identity": "A plumber who inherited a taxidermy shop", + "situation": "Getting strange calls about taxidermy", + "reason_calling": "Someone left a note", + "secret_want": "Permission to throw it all away", + "specific_details": ["elk head in basement", "note said she forgot"], + } + prompt = get_caller_prompt_slim(caller) + assert "Danny" in prompt + assert "taxidermy shop" in prompt + assert "strange calls" in prompt + assert "elk head" in prompt + assert "she forgot" in prompt + assert "Permission to throw it all away" in prompt + assert "React to what Luke says" in prompt + assert "Stay in character" in prompt + # Assert it's under 800 tokens (roughly 3200 chars) — should be ~400 tokens + assert len(prompt) < 3200