Chain to prioritize tasks.
| 77 | return cls(prompt=prompt, llm=llm, verbose=verbose) |
| 78 | |
| 79 | class TaskPrioritizationChain(LLMChain): |
| 80 | """Chain to prioritize tasks.""" |
| 81 | |
| 82 | @classmethod |
| 83 | def from_llm(cls, llm: BaseLLM, verbose: bool = True) -> LLMChain: |
| 84 | """Get the response parser.""" |
| 85 | task_prioritization_template = ( |
| 86 | "You are an task prioritization AI tasked with cleaning the formatting of and reprioritizing" |
| 87 | " the following tasks: {task_names}." |
| 88 | " Consider the ultimate objective of your team: {objective}." |
| 89 | " Do not make up any tasks, just reorganize the existing tasks." |
| 90 | " Do not remove any tasks. Return the result as a numbered list, like:" |
| 91 | " #. First task" |
| 92 | " #. Second task" |
| 93 | " Start the task list with number {next_task_id}. (e.g., 2. ***, 3. ***, etc.)" |
| 94 | ) |
| 95 | prompt = PromptTemplate( |
| 96 | template=task_prioritization_template, |
| 97 | input_variables=["task_names", "next_task_id", "objective"], |
| 98 | ) |
| 99 | return cls(prompt=prompt, llm=llm, verbose=verbose) |
| 100 | |
| 101 | def get_next_task(task_creation_chain: LLMChain, result: Dict, task_description: str, task_list: List[str], objective: str) -> List[Dict]: |
| 102 | """Get the next task.""" |
nothing calls this directly
no outgoing calls
no test coverage detected