{"version":3,"file":"chain.cjs","names":["DynamicTool"],"sources":["../../src/tools/chain.ts"],"sourcesContent":["import { DynamicTool, DynamicToolInput } from \"@langchain/core/tools\";\nimport { BaseChain } from \"../chains/base.js\";\n\n/**\n * Interface for the input parameters of the ChainTool constructor.\n * Extends the DynamicToolInput interface, replacing the 'func' property\n * with a 'chain' property.\n */\nexport interface ChainToolInput extends Omit<DynamicToolInput, \"func\"> {\n  chain: BaseChain;\n}\n\n/**\n * Class that extends DynamicTool for creating tools that can run chains.\n * Takes an instance of a class that extends BaseChain as a parameter in\n * its constructor and uses it to run the chain when its 'func' method is\n * called.\n */\nexport class ChainTool extends DynamicTool {\n  static lc_name() {\n    return \"ChainTool\";\n  }\n\n  chain: BaseChain;\n\n  constructor({ chain, ...rest }: ChainToolInput) {\n    super({\n      ...rest,\n      func: async (input, runManager) =>\n        chain.run(input, runManager?.getChild()),\n    });\n    this.chain = chain;\n  }\n}\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,YAAb,cAA+BA,sBAAAA,YAAY;CACzC,OAAO,UAAU;AACf,SAAO;;CAGT;CAEA,YAAY,EAAE,OAAO,GAAG,QAAwB;AAC9C,QAAM;GACJ,GAAG;GACH,MAAM,OAAO,OAAO,eAClB,MAAM,IAAI,OAAO,YAAY,UAAU,CAAC;GAC3C,CAAC;AACF,OAAK,QAAQ"}