Spaces:
Runtime error
Runtime error
| from langchain.llms import BaseLLM | |
| from langchain import LLMChain, PromptTemplate | |
| class TaskCreationChain(LLMChain): | |
| """Chain to generates tasks.""" | |
| def from_llm(cls, llm: BaseLLM, verbose: bool = True) -> LLMChain: | |
| """Get the response parser.""" | |
| task_creation_template = ( | |
| "You are an task creation AI that uses the result of an execution agent" | |
| " to create new tasks with the following objective: {objective}," | |
| " The last completed task has the result: {result}." | |
| " This result was based on this task description: {task_description}." | |
| " These are incomplete tasks: {incomplete_tasks}." | |
| " Based on the result, create new tasks to be completed" | |
| " by the AI system that do not overlap with incomplete tasks." | |
| " Return the tasks as an array." | |
| ) | |
| prompt = PromptTemplate( | |
| template=task_creation_template, | |
| input_variables=[ | |
| "result", | |
| "task_description", | |
| "incomplete_tasks", | |
| "objective", | |
| ], | |
| ) | |
| return cls(prompt=prompt, llm=llm, verbose=verbose) |