Files
LLMsForDisinformationAnalysis/agent/nodes/tool.ts
T
2026-01-27 22:57:49 +00:00

8 lines
341 B
TypeScript

import type { ToolCall } from "@langchain/core/messages/tool";
import { task } from "@langchain/langgraph";
import { arithmeticToolsByName } from "../tools/arithmetic";
export const toolNode = task({ name: "callTool" }, async (toolCall: ToolCall) => {
const tool = arithmeticToolsByName[toolCall.name];
return tool.invoke(toolCall);
});