TaskPlanningToolkit

class TaskPlanningToolkit(BaseToolkit):

A toolkit for task decomposition and re-planning.

init

def __init__(self, timeout: Optional[float] = None):

Initialize the TaskPlanningToolkit.

Parameters:

  • timeout (Optional[float]): The timeout for the toolkit. (default: :obj: None)

decompose_task

def decompose_task(
    self,
    original_task_content: str,
    sub_task_contents: List[str],
    original_task_id: Optional[str] = None
):

Use the tool to decompose an original task into several sub-tasks. It creates new Task objects from the provided original task content, used when the original task is complex and needs to be decomposed.

Parameters:

  • original_task_content (str): The content of the task to be decomposed.
  • sub_task_contents (List[str]): A list of strings, where each string is the content for a new sub-task.
  • original_task_id (Optional[str]): The id of the task to be decomposed. If not provided, a new id will be generated. (default: :obj: None)

Returns:

List[Task]: A list of newly created sub-task objects.

replan_tasks

def replan_tasks(
    self,
    original_task_content: str,
    sub_task_contents: List[str],
    original_task_id: Optional[str] = None
):

Use the tool to re_decompose a task into several subTasks. It creates new Task objects from the provided original task content, used when the decomposed tasks are not good enough to help finish the task.

Parameters:

  • original_task_content (str): The content of the task to be decomposed.
  • sub_task_contents (List[str]): A list of strings, where each string is the content for a new sub-task.
  • original_task_id (Optional[str]): The id of the task to be decomposed. (default: :obj: None)

Returns:

List[Task]: Reordered or modified tasks.

get_tools

def get_tools(self):