/** * LangChain JS tools: arcBeforeCheckout and arcAfterCheckout. * * npm i @langchain/core zod * import { arcBeforeCheckout, arcAfterCheckout } from "./integrations/langchain/tools"; * const agent = createReactAgent({ llm, tools: [arcBeforeCheckout, arcAfterCheckout] }); * * This file imports "@langchain/core", which the ARC app does not install, so the * repo's tsconfig excludes it. definitions.ts holds everything else and is tested. */ import { tool } from "@langchain/core/tools"; import { arcLangChainDefinitions, type ArcToolConfig } from "./definitions.ts"; export function arcCheckoutTools(config: ArcToolConfig = {}) { const { before, after } = arcLangChainDefinitions(config); return { arcBeforeCheckout: tool(before.func, { name: before.name, description: before.description, schema: before.schema }), arcAfterCheckout: tool(after.func, { name: after.name, description: after.description, schema: after.schema }), }; } export const { arcBeforeCheckout, arcAfterCheckout } = arcCheckoutTools();