|
6 | 6 | from . import level_passed |
7 | 7 | from . import passed |
8 | 8 | from . import plain |
| 9 | +from . import bandit |
9 | 10 | import builtins |
10 | 11 |
|
11 | 12 | # Verbose toggle for external previews |
@@ -246,7 +247,39 @@ def print(*args, **kwargs): # type: ignore |
246 | 247 | print("=" * 60 + "\n") |
247 | 248 | return (aux_prompt, main_prompt) if int(num_agents) > 1 else [main_prompt] |
248 | 249 |
|
249 | | - supported = ["expert_edits", "level_feedback", "level_passed", "passed", "plain"] |
| 250 | + if mode == "bandit": |
| 251 | + # Enforce flags: original_prompt=True, previous_response=False |
| 252 | + original_prompt_flag = True |
| 253 | + previous_response_flag = False |
| 254 | + if int(num_agents) == 1: |
| 255 | + main_comp = agent_completions[0] |
| 256 | + aux_comp = "" |
| 257 | + else: |
| 258 | + aux_comp, main_comp = agent_completions[0], agent_completions[1] |
| 259 | + ctx = get_context(prompt) or {} |
| 260 | + entry_point = ctx.get("entry_point", "") |
| 261 | + test_code = ctx.get("tests_sandbox") or ctx.get("tests_eval", "") |
| 262 | + aux_prompt, main_prompt = bandit.format_followup_prompts( |
| 263 | + original_prompt=prompt, |
| 264 | + aux_completion=aux_comp, |
| 265 | + main_completion=main_comp, |
| 266 | + test_code=test_code, |
| 267 | + entry_point=entry_point, |
| 268 | + original_prompt_flag=original_prompt_flag, |
| 269 | + previous_response_flag=previous_response_flag, |
| 270 | + num_agent=int(num_agents), |
| 271 | + ) |
| 272 | + print("\n" + "=" * 60) |
| 273 | + print("EXTERNAL MODE PREVIEW: bandit") |
| 274 | + print("-" * 60) |
| 275 | + if int(num_agents) > 1: |
| 276 | + print("AUX PROMPT:\n" + aux_prompt) |
| 277 | + print("-" * 60) |
| 278 | + print("MAIN PROMPT:\n" + main_prompt) |
| 279 | + print("=" * 60 + "\n") |
| 280 | + return (aux_prompt, main_prompt) if int(num_agents) > 1 else [main_prompt] |
| 281 | + |
| 282 | + supported = ["expert_edits", "level_feedback", "level_passed", "passed", "plain", "bandit"] |
250 | 283 | raise NotImplementedError( |
251 | 284 | f"External transition mode '{mode}' is not implemented yet. Supported: {', '.join(supported)}" |
252 | 285 | ) |
0 commit comments