r"""Prioritize the task list given the agent objective. Args: task_list (List[str]): The unprioritized tasks of agent. Returns: List[str]: The new prioritized task list generated by the Agent.
(
self,
task_list: List[str],
)
| 380 | ) |
| 381 | |
| 382 | def run( |
| 383 | self, |
| 384 | task_list: List[str], |
| 385 | ) -> List[str]: |
| 386 | r"""Prioritize the task list given the agent objective. |
| 387 | |
| 388 | Args: |
| 389 | task_list (List[str]): The unprioritized tasks of agent. |
| 390 | |
| 391 | Returns: |
| 392 | List[str]: The new prioritized task list generated by the Agent. |
| 393 | """ |
| 394 | task_prioritization_prompt = self.task_prioritization_prompt.format( |
| 395 | task_list=task_list |
| 396 | ) |
| 397 | |
| 398 | task_msg = BaseMessage.make_user_message( |
| 399 | role_name="Task Prioritizer", content=task_prioritization_prompt |
| 400 | ) |
| 401 | |
| 402 | task_response = self.step(task_msg) |
| 403 | |
| 404 | if task_response.terminated: |
| 405 | raise RuntimeError("Task prioritization failed.") |
| 406 | if len(task_response.msgs) == 0: |
| 407 | raise RuntimeError("Got no task prioritization message.") |
| 408 | |
| 409 | sub_tasks_msg = task_response.msgs[0] |
| 410 | return get_task_list(sub_tasks_msg.content) |
nothing calls this directly
no test coverage detected