feat(core): Implement partial execution for all tool nodes (#15168)

This commit is contained in:
Benjamin Schroth
2025-05-12 12:31:17 +02:00
committed by GitHub
parent d12c7ee87f
commit 8b467e3f56
39 changed files with 1129 additions and 279 deletions

View File

@@ -0,0 +1,20 @@
import type { StructuredTool } from 'langchain/tools';
import { type IDataObject, type INodeExecutionData } from 'n8n-workflow';
import { convertObjectBySchema } from './convertToSchema';
export async function executeTool(
tool: StructuredTool,
query: string | object,
): Promise<INodeExecutionData> {
let convertedQuery: string | object = query;
if ('schema' in tool && tool.schema) {
convertedQuery = convertObjectBySchema(query, tool.schema);
}
const result = await tool.invoke(convertedQuery);
return {
json: result as IDataObject,
};
}