{"version":3,"file":"outputParser.cjs","names":["BaseOutputParser","PLANNER_SYSTEM_PROMPT_MESSAGE_TEMPLATE"],"sources":["../../../src/experimental/plan_and_execute/outputParser.ts"],"sourcesContent":["import { BaseOutputParser } from \"@langchain/core/output_parsers\";\nimport { Plan } from \"./base.js\";\n\nimport { PLANNER_SYSTEM_PROMPT_MESSAGE_TEMPLATE } from \"./prompt.js\";\n\n/**\n * Specific implementation of the `BaseOutputParser` class designed to\n * parse the output text into a `Plan` object.\n */\nexport class PlanOutputParser extends BaseOutputParser<Plan> {\n  lc_namespace = [\"langchain\", \"experimental\", \"plan_and_execute\"];\n\n  /**\n   * Parses the output text into a `Plan` object. The steps are extracted by\n   * splitting the text on newline followed by a number and a period,\n   * indicating the start of a new step. The `<END_OF_PLAN>` tag is then\n   * removed from each step.\n   * @param text The output text to be parsed.\n   * @returns A `Plan` object consisting of a series of steps.\n   */\n  async parse(text: string): Promise<Plan> {\n    return {\n      steps: text\n        .split(/\\n\\d+\\.\\s?/)\n        .slice(1)\n        .map((step) => ({ text: step.replace(`<END_OF_PLAN>`, \"\") })),\n    };\n  }\n\n  /**\n   * Returns a string that represents the format instructions for the plan.\n   * This is defined by the `PLANNER_SYSTEM_PROMPT_MESSAGE_TEMPLATE`\n   * constant.\n   * @returns A string representing the format instructions for the plan.\n   */\n  getFormatInstructions(): string {\n    return PLANNER_SYSTEM_PROMPT_MESSAGE_TEMPLATE;\n  }\n}\n"],"mappings":";;;;;;;;AASA,IAAa,mBAAb,cAAsCA,+BAAAA,iBAAuB;CAC3D,eAAe;EAAC;EAAa;EAAgB;EAAmB;;;;;;;;;CAUhE,MAAM,MAAM,MAA6B;AACvC,SAAO,EACL,OAAO,KACJ,MAAM,aAAa,CACnB,MAAM,EAAE,CACR,KAAK,UAAU,EAAE,MAAM,KAAK,QAAQ,iBAAiB,GAAG,EAAE,EAAE,EAChE;;;;;;;;CASH,wBAAgC;AAC9B,SAAOC,eAAAA"}