MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / TaskCreationChain

Class TaskCreationChain

bmtools/agent/BabyagiTools.py:39–62  ·  view source on GitHub ↗

Chain to generates tasks.

Source from the content-addressed store, hash-verified

37 return thoughts
38
39class 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
64class InitialTaskCreationChain(LLMChain):
65 """Chain to generates tasks."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected