{"version":3,"file":"task_prioritization.cjs","names":["LLMChain","PromptTemplate"],"sources":["../../../src/experimental/babyagi/task_prioritization.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\nimport { LLMChain, LLMChainInput } from \"../../chains/llm_chain.js\";\n\n/** Chain to prioritize tasks. */\nexport class TaskPrioritizationChain extends LLMChain {\n  static lc_name() {\n    return \"TaskPrioritizationChain\";\n  }\n\n  /**\n   * Static method to create a new TaskPrioritizationChain from a\n   * BaseLanguageModel. It generates a prompt using the PromptTemplate class\n   * and the task prioritization template, and returns a new instance of\n   * TaskPrioritizationChain.\n   * @param fields Object with fields used to initialize the chain, excluding the prompt.\n   * @returns A new instance of TaskPrioritizationChain.\n   */\n  static fromLLM(fields: Omit<LLMChainInput, \"prompt\">): LLMChain {\n    const taskPrioritizationTemplate =\n      `You are a task prioritization AI tasked with cleaning the formatting of ` +\n      `and reprioritizing the following tasks: {task_names}.` +\n      ` Consider the ultimate objective of your team: {objective}.` +\n      ` Do not remove any tasks. Return the result as a numbered list, like:` +\n      ` #. First task` +\n      ` #. Second task` +\n      ` Start the task list with number {next_task_id}.`;\n    const prompt = new PromptTemplate({\n      template: taskPrioritizationTemplate,\n      inputVariables: [\"task_names\", \"next_task_id\", \"objective\"],\n    });\n    return new TaskPrioritizationChain({ prompt, ...fields });\n  }\n}\n"],"mappings":";;;;;AAIA,IAAa,0BAAb,MAAa,gCAAgCA,kBAAAA,SAAS;CACpD,OAAO,UAAU;AACf,SAAO;;;;;;;;;;CAWT,OAAO,QAAQ,QAAiD;AAa9D,SAAO,IAAI,wBAAwB;GAAE,QAJtB,IAAIC,wBAAAA,eAAe;IAChC,UARA;IASA,gBAAgB;KAAC;KAAc;KAAgB;KAAY;IAC5D,CAAC;GAC2C,GAAG;GAAQ,CAAC"}