roast: use chat API with system prompt + few-shot example for actual biting roasts
Switch from api/generate to api/chat so we can set a system role that instructs the model to be genuinely savage. Add a few-shot example so it knows what a roast looks like vs a backhanded compliment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-8
@@ -1777,22 +1777,33 @@ async def cmd_roast(client: AsyncClient, room_id: str, sender: str, args: str):
|
||||
lore = bio
|
||||
break
|
||||
|
||||
lore_clause = f" Here is some context about them: {lore}" if lore else ""
|
||||
prompt = (
|
||||
f"You are a comedy roast writer for a group of friends who all consented to being roasted for fun. "
|
||||
f"Write a savage, witty, 1-2 sentence roast of a person named {display_name}.{lore_clause} "
|
||||
f"Make it clever and specific. Output only the roast itself — no intro, no disclaimers, no apologies."
|
||||
lore_clause = f"\nFacts about {display_name}: {lore}" if lore else ""
|
||||
system_msg = (
|
||||
"You are a savage comedy roast writer. Your job is to write brutal, funny, specific roasts. "
|
||||
"A roast is NOT a compliment. It makes fun of the person's job, habits, appearance, or life choices. "
|
||||
"Example of a good roast of a gamer: 'You've spent so many hours grinding XP you forgot to grind IRL — "
|
||||
"congrats on hitting level 30 while your credit score is still level 1.' "
|
||||
"Rules: output ONLY the roast, 1-2 sentences max, no softening, no disclaimers, no 'but seriously', "
|
||||
"no compliments hidden in the roast. Be mean but funny."
|
||||
)
|
||||
user_msg = f"Write a roast of {display_name}.{lore_clause}"
|
||||
|
||||
try:
|
||||
timeout = aiohttp.ClientTimeout(total=30)
|
||||
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||
async with session.post(
|
||||
f"{OLLAMA_URL}/api/generate",
|
||||
json={"model": BALL_MODEL, "prompt": prompt, "stream": False},
|
||||
f"{OLLAMA_URL}/api/chat",
|
||||
json={
|
||||
"model": BALL_MODEL,
|
||||
"stream": False,
|
||||
"messages": [
|
||||
{"role": "system", "content": system_msg},
|
||||
{"role": "user", "content": user_msg},
|
||||
],
|
||||
},
|
||||
) as response:
|
||||
data = await response.json()
|
||||
roast = data.get("response", "").strip()
|
||||
roast = data.get("message", {}).get("content", "").strip()
|
||||
if not roast:
|
||||
raise ValueError("Empty roast response")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user