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

Function log_trial

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

Source from the content-addressed store, hash-verified

21 return prefix.strip('\n').strip() + '\n' + suffix.strip('\n').strip()
22
23def log_trial(agents, trial_n):
24 correct, incorrect, not_finish = summarize_trial(agents)
25
26 log = f"""
27########################################
28BEGIN TRIAL {trial_n}
29Trial summary: Correct: {len(correct)}, Incorrect: {len(incorrect)} , Not Finished: {len(not_finish)}
30#######################################
31"""
32
33 log += '------------- BEGIN CORRECT AGENTS -------------\n\n'
34 for agent in correct:
35 # log += remove_fewshot(agent._build_agent_prompt()) + f'\nCorrect answer: {agent.key}\n\n'
36 log += agent._build_agent_prompt() + f'\nCorrect answer: {agent.key}\n\n'
37
38 log += '------------- BEGIN INCORRECT AGENTS -----------\n\n'
39 for agent in incorrect:
40 # log += remove_fewshot(agent._build_agent_prompt()) + f'\nCorrect answer: {agent.key}\n\n'
41 log += agent._build_agent_prompt() + f'\nCorrect answer: {agent.key}\n\n'
42
43 log += '------------- BEGIN NOT_FINISH AGENTS -----------\n\n'
44 for agent in not_finish:
45 log += agent._build_agent_prompt() + f'\nCorrect answer: {agent.key}\n\n'
46
47 return log
48
49def summarize_trial_detailed(agents):
50 correct = [a.is_correct() for a in agents]

Callers

nothing calls this directly

Calls 2

summarize_trialFunction · 0.85
_build_agent_promptMethod · 0.45

Tested by

no test coverage detected