(agents, trial_n)
| 119 | return correct, reward |
| 120 | |
| 121 | def log_react_trial(agents, trial_n): |
| 122 | correct, incorrect, halted = summarize_react_trial(agents) |
| 123 | |
| 124 | log = f""" |
| 125 | ######################################## |
| 126 | BEGIN TRIAL {trial_n} |
| 127 | Trial summary: Correct: {len(correct)}, Incorrect: {len(incorrect)}, Halted: {len(halted)} |
| 128 | ####################################### |
| 129 | """ |
| 130 | |
| 131 | log += '------------- BEGIN CORRECT AGENTS -------------\n\n' |
| 132 | for agent in correct: |
| 133 | log += remove_fewshot(agent._build_agent_prompt()) + f'\nCorrect answer: {agent.key}\n\n' |
| 134 | |
| 135 | log += '------------- BEGIN INCORRECT AGENTS -----------\n\n' |
| 136 | for agent in incorrect: |
| 137 | log += remove_fewshot(agent._build_agent_prompt()) + f'\nCorrect answer: {agent.key}\n\n' |
| 138 | |
| 139 | log += '------------- BEGIN HALTED AGENTS -----------\n\n' |
| 140 | for agent in halted: |
| 141 | log += remove_fewshot(agent._build_agent_prompt()) + f'\nCorrect answer: {agent.key}\n\n' |
| 142 | |
| 143 | return log |
| 144 | |
| 145 | def save_agents(agents, dir: str): |
| 146 | os.makedirs(dir, exist_ok=True) |
nothing calls this directly
no test coverage detected