mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
feat(core): Implement partial execution for all tool nodes (#15168)
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user