Add slim caller prompt builder (~400 tokens)
This commit is contained in:
@@ -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 = "",
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user