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

Function log_agent

eval_heldout/hotpotQA/src/utils.py:57–69  ·  view source on GitHub ↗
(agent, file_path)

Source from the content-addressed store, hash-verified

55 return correct, reward, error, halted, incorrect
56
57def log_agent(agent, file_path):
58 question = agent.question
59 g_truth = agent.key
60 correct = agent.is_correct()
61 reward = agent.reward()[0]
62 halted = agent.is_halted()
63 error = agent.run_error
64 prompt = agent._build_agent_prompt()
65 save_dict = {"question":question, "answer":g_truth, "correct":correct, "reward":reward,
66 "halted":halted, "error":error,"prompt":prompt}
67 with open(file_path, 'w') as f:
68 json.dump(save_dict, f)
69 f.write("\n")
70
71
72def get_all_agent_sessions(file_name):

Callers

nothing calls this directly

Calls 5

is_correctMethod · 0.80
rewardMethod · 0.80
is_haltedMethod · 0.80
_build_agent_promptMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected