From 81d7ea4938e6de46c868fb1263a425abc07e1287 Mon Sep 17 00:00:00 2001 From: YurenHao0426 Date: Sat, 14 Feb 2026 04:06:37 +0000 Subject: Include elimination info in debate prompts so remaining debaters stop referencing eliminated participants Co-Authored-By: Claude Opus 4.6 --- backend/app/services/debate.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/app/services/debate.py b/backend/app/services/debate.py index 086dde1..fa63985 100644 --- a/backend/app/services/debate.py +++ b/backend/app/services/debate.py @@ -24,6 +24,12 @@ def _format_history(debate_history: List[Dict[str, Any]]) -> str: text += f"\n--- Round {rn} ---\n" for resp in past_round["responses"]: text += f"\n[{resp['model']}]:\n{resp['response']}\n" + for elim in past_round.get("eliminated", []): + convinced_by = elim.get("convinced_by") + if convinced_by: + text += f"\n[{elim['model']} was convinced by {convinced_by} and left the debate]\n" + else: + text += f"\n[{elim['model']} conceded and left the debate]\n" return text @@ -496,9 +502,14 @@ async def debate_event_stream( # Process eliminations eliminated_this_round = [] + eliminated_details = [] for cfg, result in zip(active_configs, results): if result["convinced"]: eliminated_this_round.append(cfg.model_name) + eliminated_details.append({ + "model": cfg.model_name, + "convinced_by": result.get("convinced_by"), + }) yield _sse_event({ "type": "model_eliminated", "data": { @@ -509,6 +520,10 @@ async def debate_event_stream( }, }) + # Store elimination info in debate history so prompts include it + if eliminated_details: + debate_history[-1]["eliminated"] = eliminated_details + # Remove eliminated models from active list if eliminated_this_round: active_indices = [ -- cgit v1.2.3