Run the environment from scratch until it is done.
(self)
| 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( |
nothing calls this directly
no test coverage detected