MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / log_react_trial

Function log_react_trial

eval_heldout/hotpotQA/src/utils.py:121–143  ·  view source on GitHub ↗
(agents, trial_n)

Source from the content-addressed store, hash-verified

119 return correct, reward
120
121def log_react_trial(agents, trial_n):
122 correct, incorrect, halted = summarize_react_trial(agents)
123
124 log = f"""
125########################################
126BEGIN TRIAL {trial_n}
127Trial 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
145def save_agents(agents, dir: str):
146 os.makedirs(dir, exist_ok=True)

Callers

nothing calls this directly

Calls 3

summarize_react_trialFunction · 0.85
remove_fewshotFunction · 0.85
_build_agent_promptMethod · 0.45

Tested by

no test coverage detected