diff options
| author | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-14 04:06:37 +0000 |
|---|---|---|
| committer | YurenHao0426 <blackhao0426@gmail.com> | 2026-02-14 04:06:37 +0000 |
| commit | 81d7ea4938e6de46c868fb1263a425abc07e1287 (patch) | |
| tree | 214165d5f75750781f6121481a19cbbbfaa13765 /backend | |
| parent | ac9611478b4f394e62e4e4b2813dad337e22e698 (diff) | |
Include elimination info in debate prompts so remaining debaters stop referencing eliminated participants
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/app/services/debate.py | 15 |
1 files changed, 15 insertions, 0 deletions
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 = [ |
