MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / run

Method run

HATE/basic_hate/agentverse/tasksolving_iter.py:75–97  ·  view source on GitHub ↗

Run the environment from scratch until it is done.

(self)

Source from the content-addressed store, hash-verified

73 return cls(environment=environment, task=task, data_iter=data_iter)
74
75 def run(self):
76 """Run the environment from scratch until it is done."""
77
78 self.logs = []
79 total_decision_making_process = []
80 advice = "No advice yet."
81 previous_plan = "No solution yet."
82 for i, example in enumerate(tqdm(self.data_iter, total=len(self.data_iter.examples))):
83 if i >= self.data_max_len and self.data_max_len > 0:
84 break
85 self.environment.reset()
86 advice = "No advice yet."
87 previous_plan = "No solution yet."
88 self.environment.set_task_description(example["input"])
89 while not self.environment.is_done():
90 result, advice, previous_plan, logs, success, decision_making_process = asyncio.run(
91 self.environment.step(advice, previous_plan)
92 )
93 self.logs += logs
94 total_decision_making_process += decision_making_process
95 self.environment.report_metrics()
96 self.save_result(previous_plan, result, self.environment.get_spend())
97 return previous_plan, result, self.logs, total_decision_making_process
98
99 def singleagent_thinking(self, preliminary_solution, advice) -> str:
100 preliminary_solution = self.environment.solve(

Callers

nothing calls this directly

Calls 7

save_resultMethod · 0.95
resetMethod · 0.45
set_task_descriptionMethod · 0.45
is_doneMethod · 0.45
stepMethod · 0.45
report_metricsMethod · 0.45
get_spendMethod · 0.45

Tested by

no test coverage detected