(agent, msg, num_retries=1)
| 244 | |
| 245 | |
| 246 | def run_code_from_agent(agent, msg, num_retries=1): |
| 247 | agent.reset() |
| 248 | log = [] |
| 249 | for attempt in range(num_retries + 1): # +1 to include the initial attempt |
| 250 | response = agent.step(msg) |
| 251 | code = match_response(response) |
| 252 | output, error = run_code(code) |
| 253 | log.append((code, output, error)) |
| 254 | |
| 255 | if error is None: |
| 256 | return log |
| 257 | |
| 258 | if attempt < num_retries: |
| 259 | print(f"Retrying... Attempt {attempt + 1} of {num_retries}") |
| 260 | msg = error |
| 261 | |
| 262 | return log |
| 263 | |
| 264 | def run_modular(all_code, file_name, with_border=True, with_label=True): |
| 265 | concatenated_code = utils_functions |
nothing calls this directly
no test coverage detected