mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
feat(AI Agent Tool Node): Add Agent Tool (#17108)
This commit is contained in:
@@ -143,3 +143,14 @@ export const textFromPreviousNode: INodeProperties = {
|
||||
},
|
||||
disabledOptions: { show: { promptType: ['auto'] } },
|
||||
};
|
||||
|
||||
export const toolDescription: INodeProperties = {
|
||||
displayName: 'Description',
|
||||
name: 'toolDescription',
|
||||
type: 'string',
|
||||
default: 'AI Agent that can call other tools',
|
||||
required: true,
|
||||
typeOptions: { rows: 2 },
|
||||
description:
|
||||
'Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often',
|
||||
};
|
||||
|
||||
@@ -75,16 +75,16 @@ export function isToolsInstance(model: unknown): model is Tool {
|
||||
}
|
||||
|
||||
export function getPromptInputByType(options: {
|
||||
ctx: IExecuteFunctions;
|
||||
ctx: IExecuteFunctions | ISupplyDataFunctions;
|
||||
i: number;
|
||||
promptTypeKey: string;
|
||||
inputKey: string;
|
||||
}) {
|
||||
const { ctx, i, promptTypeKey, inputKey } = options;
|
||||
const prompt = ctx.getNodeParameter(promptTypeKey, i) as string;
|
||||
const promptType = ctx.getNodeParameter(promptTypeKey, i, 'define') as string;
|
||||
|
||||
let input;
|
||||
if (prompt === 'auto') {
|
||||
if (promptType === 'auto') {
|
||||
input = ctx.evaluateExpression('{{ $json["chatInput"] }}', i) as string;
|
||||
} else {
|
||||
input = ctx.getNodeParameter(inputKey, i) as string;
|
||||
@@ -186,7 +186,7 @@ export function escapeSingleCurlyBrackets(text?: string): string | undefined {
|
||||
}
|
||||
|
||||
export const getConnectedTools = async (
|
||||
ctx: IExecuteFunctions | IWebhookFunctions,
|
||||
ctx: IExecuteFunctions | IWebhookFunctions | ISupplyDataFunctions,
|
||||
enforceUniqueNames: boolean,
|
||||
convertStructuredTool: boolean = true,
|
||||
escapeCurlyBrackets: boolean = false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IExecuteFunctions } from 'n8n-workflow';
|
||||
import type { IExecuteFunctions, ISupplyDataFunctions } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { N8nItemListOutputParser } from './N8nItemListOutputParser';
|
||||
@@ -13,7 +13,7 @@ export type N8nOutputParser =
|
||||
export { N8nOutputFixingParser, N8nItemListOutputParser, N8nStructuredOutputParser };
|
||||
|
||||
export async function getOptionalOutputParser(
|
||||
ctx: IExecuteFunctions,
|
||||
ctx: IExecuteFunctions | ISupplyDataFunctions,
|
||||
index: number = 0,
|
||||
): Promise<N8nOutputParser | undefined> {
|
||||
let outputParser: N8nOutputParser | undefined;
|
||||
|
||||
Reference in New Issue
Block a user