Chain to generates tasks.
| 37 | return thoughts |
| 38 | |
| 39 | class TaskCreationChain(LLMChain): |
| 40 | """Chain to generates tasks.""" |
| 41 | |
| 42 | @classmethod |
| 43 | def from_llm(cls, llm: BaseLLM, verbose: bool = True) -> LLMChain: |
| 44 | """Get the response parser.""" |
| 45 | task_creation_template = ( |
| 46 | "You are an task creation AI that uses the result of an execution agent" |
| 47 | " to create new tasks with the following objective: {objective}," |
| 48 | " The last completed task has the result: {result}." |
| 49 | " This result was based on this task description: {task_description}." |
| 50 | " These are incomplete tasks: {incomplete_tasks}." |
| 51 | " Based on the result, create new tasks to be completed" |
| 52 | " by the AI system that do not overlap with incomplete tasks." |
| 53 | " For a simple objective, do not generate complex todo lists." |
| 54 | " Do not generate repetitive tasks (e.g., tasks that have already been completed)." |
| 55 | " If there is not futher task needed to complete the objective, return NO TASK." |
| 56 | " Now return the tasks as an array." |
| 57 | ) |
| 58 | prompt = PromptTemplate( |
| 59 | template=task_creation_template, |
| 60 | input_variables=["result", "task_description", "incomplete_tasks", "objective"], |
| 61 | ) |
| 62 | return cls(prompt=prompt, llm=llm, verbose=verbose) |
| 63 | |
| 64 | class InitialTaskCreationChain(LLMChain): |
| 65 | """Chain to generates tasks.""" |
nothing calls this directly
no outgoing calls
no test coverage detected