mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
refactor: Migrate NodeConnectionType to const object type (no-changelog) (#14078)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeInputConfiguration,
|
||||
INodeInputFilter,
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
INodeProperties,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';
|
||||
@@ -85,7 +86,7 @@ function getInputs(
|
||||
if (agent === 'conversationalAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatAnthropic',
|
||||
@@ -103,19 +104,19 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'toolsAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatAnthropic',
|
||||
@@ -133,20 +134,20 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'openAiFunctionsAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
||||
@@ -155,57 +156,55 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'reActAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'sqlAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'planAndExecuteAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (hasOutputParser === false) {
|
||||
specialInputs = specialInputs.filter(
|
||||
(input) => input.type !== NodeConnectionType.AiOutputParser,
|
||||
);
|
||||
specialInputs = specialInputs.filter((input) => input.type !== 'ai_outputParser');
|
||||
}
|
||||
return [NodeConnectionType.Main, ...getInputData(specialInputs)];
|
||||
return ['main', ...getInputData(specialInputs)];
|
||||
}
|
||||
|
||||
const agentTypeProperty: INodeProperties = {
|
||||
@@ -290,7 +289,7 @@ export class Agent implements INodeType {
|
||||
return getInputs(agent, hasOutputParser)
|
||||
})($parameter.agent, $parameter.hasOutputParser === undefined || $parameter.hasOutputParser === true)
|
||||
}}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
|
||||
@@ -430,7 +429,7 @@ export class Agent implements INodeType {
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionType.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
name: 'notice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import { initializeAgentExecutorWithOptions } from 'langchain/agents';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { isChatInstance, getPromptInputByType, getConnectedTools } from '@utils/helpers';
|
||||
import { getOptionalOutputParser } from '@utils/output_parsers/N8nOutputParser';
|
||||
@@ -16,13 +16,13 @@ export async function conversationalAgentExecute(
|
||||
nodeVersion: number,
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
this.logger.debug('Executing Conversational Agent');
|
||||
const model = await this.getInputConnectionData(NodeConnectionType.AiLanguageModel, 0);
|
||||
const model = await this.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);
|
||||
|
||||
if (!isChatInstance(model)) {
|
||||
throw new NodeOperationError(this.getNode(), 'Conversational Agent requires Chat Model');
|
||||
}
|
||||
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BufferMemory, type BaseChatMemory } from 'langchain/memory';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function openAiFunctionsAgentExecute(
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
this.logger.debug('Executing OpenAi Functions Agent');
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as ChatOpenAI;
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function openAiFunctionsAgentExecute(
|
||||
'OpenAI Functions Agent requires OpenAI Chat Model',
|
||||
);
|
||||
}
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
const tools = await getConnectedTools(this, nodeVersion >= 1.5, false);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { PlanAndExecuteAgentExecutor } from 'langchain/experimental/plan_and_exe
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function planAndExecuteAgentExecute(
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
this.logger.debug('Executing PlanAndExecute Agent');
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseChatModel;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AgentExecutor, ChatAgent, ZeroShotAgent } from 'langchain/agents';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function reActAgentAgentExecute(
|
||||
): Promise<INodeExecutionData[][]> {
|
||||
this.logger.debug('Executing ReAct Agent');
|
||||
|
||||
const model = (await this.getInputConnectionData(NodeConnectionType.AiLanguageModel, 0)) as
|
||||
const model = (await this.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0)) as
|
||||
| BaseLanguageModel
|
||||
| BaseChatModel;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SqlDatabase } from 'langchain/sql_db';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
type IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
@@ -32,7 +32,7 @@ export async function sqlAgentAgentExecute(
|
||||
this.logger.debug('Executing SQL Agent');
|
||||
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
const items = this.getInputData();
|
||||
@@ -113,7 +113,7 @@ export async function sqlAgentAgentExecute(
|
||||
const toolkit = new SqlToolkit(dbInstance, model);
|
||||
const agentExecutor = createSqlAgent(model, toolkit, agentOptions);
|
||||
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { AgentAction, AgentFinish } from 'langchain/agents';
|
||||
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents';
|
||||
import type { ToolsAgentAction } from 'langchain/dist/agents/tool_calling/output_parser';
|
||||
import { omit } from 'lodash';
|
||||
import { BINARY_ENCODING, jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import type { ZodObject } from 'zod';
|
||||
import { z } from 'zod';
|
||||
@@ -275,7 +275,7 @@ export const getAgentStepsParser =
|
||||
* @returns The validated chat model
|
||||
*/
|
||||
export async function getChatModel(ctx: IExecuteFunctions): Promise<BaseChatModel> {
|
||||
const model = await ctx.getInputConnectionData(NodeConnectionType.AiLanguageModel, 0);
|
||||
const model = await ctx.getInputConnectionData(NodeConnectionTypes.AiLanguageModel, 0);
|
||||
if (!isChatInstance(model) || !model.bindTools) {
|
||||
throw new NodeOperationError(
|
||||
ctx.getNode(),
|
||||
@@ -294,7 +294,7 @@ export async function getChatModel(ctx: IExecuteFunctions): Promise<BaseChatMode
|
||||
export async function getOptionalMemory(
|
||||
ctx: IExecuteFunctions,
|
||||
): Promise<BaseChatMemory | undefined> {
|
||||
return (await ctx.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
return (await ctx.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AgentExecutor } from 'langchain/agents';
|
||||
import type { OpenAIToolType } from 'langchain/dist/experimental/openai_assistant/schema';
|
||||
import { OpenAIAssistantRunnable } from 'langchain/experimental/openai_assistant';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
@@ -44,10 +44,10 @@ export class OpenAiAssistant implements INodeType {
|
||||
},
|
||||
},
|
||||
inputs: [
|
||||
{ type: NodeConnectionType.Main },
|
||||
{ type: NodeConnectionType.AiTool, displayName: 'Tools' },
|
||||
{ type: NodeConnectionTypes.Main },
|
||||
{ type: NodeConnectionTypes.AiTool, displayName: 'Tools' },
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'openAiApi',
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeApiError, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { getPromptInputByType } from '@utils/helpers';
|
||||
import { getOptionalOutputParser } from '@utils/output_parsers/N8nOutputParser';
|
||||
@@ -55,7 +55,7 @@ export class ChainLlm implements INodeType {
|
||||
},
|
||||
},
|
||||
inputs: `={{ ((parameter) => { ${getInputs.toString()}; return getInputs(parameter) })($parameter) }}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [],
|
||||
properties: nodeProperties,
|
||||
};
|
||||
@@ -73,7 +73,7 @@ export class ChainLlm implements INodeType {
|
||||
try {
|
||||
// Get the language model
|
||||
const llm = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
HumanMessagePromptTemplate,
|
||||
SystemMessagePromptTemplate,
|
||||
} from '@langchain/core/prompts';
|
||||
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import type { IDataObject, INodeInputConfiguration, INodeProperties } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { promptTypeOptions, textFromPreviousNode } from '@utils/descriptions';
|
||||
import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||
@@ -13,7 +13,7 @@ import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||
* Dynamic input configuration generation based on node parameters
|
||||
*/
|
||||
export function getInputs(parameters: IDataObject) {
|
||||
const inputs = [
|
||||
const inputs: INodeInputConfiguration[] = [
|
||||
{ displayName: '', type: 'main' },
|
||||
{
|
||||
displayName: 'Model',
|
||||
@@ -260,7 +260,7 @@ export const nodeProperties: INodeProperties[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionType.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
name: 'notice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HumanMessage } from '@langchain/core/messages';
|
||||
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
||||
import { ChatOllama } from '@langchain/ollama';
|
||||
import type { IExecuteFunctions, IBinaryData } from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionType, OperationalError } from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionTypes, OperationalError } from 'n8n-workflow';
|
||||
|
||||
import type { MessageTemplate } from './types';
|
||||
|
||||
@@ -69,7 +69,7 @@ export async function createImageMessage({
|
||||
|
||||
const bufferData = await context.helpers.getBinaryDataBuffer(itemIndex, binaryDataKey);
|
||||
const model = (await context.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { FakeChatModel } from '@langchain/core/utils/testing';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { IExecuteFunctions, INode } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import * as helperModule from '@utils/helpers';
|
||||
import * as outputParserModule from '@utils/output_parsers/N8nOutputParser';
|
||||
@@ -64,7 +64,7 @@ describe('ChainLlm Node', () => {
|
||||
expect(node.description.version).toContain(1.5);
|
||||
expect(node.description.properties).toBeDefined();
|
||||
expect(node.description.inputs).toBeDefined();
|
||||
expect(node.description.outputs).toEqual([NodeConnectionType.Main]);
|
||||
expect(node.description.outputs).toEqual([NodeConnectionTypes.Main]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { getInputs, nodeProperties } from '../methods/config';
|
||||
|
||||
@@ -8,24 +8,24 @@ describe('config', () => {
|
||||
const inputs = getInputs({});
|
||||
|
||||
expect(inputs).toHaveLength(3);
|
||||
expect(inputs[0].type).toBe(NodeConnectionType.Main);
|
||||
expect(inputs[1].type).toBe(NodeConnectionType.AiLanguageModel);
|
||||
expect(inputs[2].type).toBe(NodeConnectionType.AiOutputParser);
|
||||
expect(inputs[0].type).toBe(NodeConnectionTypes.Main);
|
||||
expect(inputs[1].type).toBe(NodeConnectionTypes.AiLanguageModel);
|
||||
expect(inputs[2].type).toBe(NodeConnectionTypes.AiOutputParser);
|
||||
});
|
||||
|
||||
it('should exclude the OutputParser when hasOutputParser is false', () => {
|
||||
const inputs = getInputs({ hasOutputParser: false });
|
||||
|
||||
expect(inputs).toHaveLength(2);
|
||||
expect(inputs[0].type).toBe(NodeConnectionType.Main);
|
||||
expect(inputs[1].type).toBe(NodeConnectionType.AiLanguageModel);
|
||||
expect(inputs[0].type).toBe(NodeConnectionTypes.Main);
|
||||
expect(inputs[1].type).toBe(NodeConnectionTypes.AiLanguageModel);
|
||||
});
|
||||
|
||||
it('should include the OutputParser when hasOutputParser is true', () => {
|
||||
const inputs = getInputs({ hasOutputParser: true });
|
||||
|
||||
expect(inputs).toHaveLength(3);
|
||||
expect(inputs[2].type).toBe(NodeConnectionType.AiOutputParser);
|
||||
expect(inputs[2].type).toBe(NodeConnectionTypes.AiOutputParser);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||
import { createStuffDocumentsChain } from 'langchain/chains/combine_documents';
|
||||
import { createRetrievalChain } from 'langchain/chains/retrieval';
|
||||
import { NodeConnectionType, NodeOperationError, parseErrorMetadata } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError, parseErrorMetadata } from 'n8n-workflow';
|
||||
import {
|
||||
type INodeProperties,
|
||||
type IExecuteFunctions,
|
||||
@@ -70,21 +70,21 @@ export class ChainRetrievalQa implements INodeType {
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [],
|
||||
properties: [
|
||||
getTemplateNoticeField(1960),
|
||||
@@ -192,12 +192,12 @@ export class ChainRetrievalQa implements INodeType {
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
try {
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
const retriever = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiRetriever,
|
||||
NodeConnectionTypes.AiRetriever,
|
||||
0,
|
||||
)) as BaseRetriever;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||
import { FakeChatModel, FakeLLM, FakeRetriever } from '@langchain/core/utils/testing';
|
||||
import get from 'lodash/get';
|
||||
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError, UnexpectedError } from 'n8n-workflow';
|
||||
import type { IDataObject, IExecuteFunctions, NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError, UnexpectedError } from 'n8n-workflow';
|
||||
|
||||
import { ChainRetrievalQa } from '../ChainRetrievalQa.node';
|
||||
|
||||
@@ -27,10 +27,10 @@ const createExecuteFunctionsMock = (
|
||||
};
|
||||
},
|
||||
getInputConnectionData(type: NodeConnectionType) {
|
||||
if (type === NodeConnectionType.AiLanguageModel) {
|
||||
if (type === NodeConnectionTypes.AiLanguageModel) {
|
||||
return fakeLlm;
|
||||
}
|
||||
if (type === NodeConnectionType.AiRetriever) {
|
||||
if (type === NodeConnectionTypes.AiRetriever) {
|
||||
return fakeRetriever;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import type { SummarizationChainParams } from 'langchain/chains';
|
||||
import { loadSummarizationChain } from 'langchain/chains';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeTypeBaseDescription,
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
@@ -31,21 +31,21 @@ export class ChainSummarizationV1 implements INodeType {
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Document',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: NodeConnectionTypes.AiDocument,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [],
|
||||
properties: [
|
||||
getTemplateNoticeField(1951),
|
||||
@@ -167,11 +167,11 @@ export class ChainSummarizationV1 implements INodeType {
|
||||
const type = this.getNodeParameter('type', 0) as 'map_reduce' | 'stuff' | 'refine';
|
||||
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
|
||||
@@ -10,8 +10,9 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IDataObject,
|
||||
INodeInputConfiguration,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
@@ -24,7 +25,7 @@ import { REFINE_PROMPT_TEMPLATE, DEFAULT_PROMPT_TEMPLATE } from '../prompt';
|
||||
function getInputs(parameters: IDataObject) {
|
||||
const chunkingMode = parameters?.chunkingMode;
|
||||
const operationMode = parameters?.operationMode;
|
||||
const inputs = [
|
||||
const inputs: INodeInputConfiguration[] = [
|
||||
{ displayName: '', type: 'main' },
|
||||
{
|
||||
displayName: 'Model',
|
||||
@@ -69,7 +70,7 @@ export class ChainSummarizationV2 implements INodeType {
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: `={{ ((parameter) => { ${getInputs.toString()}; return getInputs(parameter) })($parameter) }}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [],
|
||||
properties: [
|
||||
getTemplateNoticeField(1951),
|
||||
@@ -327,7 +328,7 @@ export class ChainSummarizationV2 implements INodeType {
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
try {
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
@@ -356,7 +357,7 @@ export class ChainSummarizationV2 implements INodeType {
|
||||
// Use dedicated document loader input to load documents
|
||||
if (operationMode === 'documentLoader') {
|
||||
const documentInput = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiDocument,
|
||||
NodeConnectionTypes.AiDocument,
|
||||
0,
|
||||
)) as N8nJsonLoader | Array<Document<Record<string, unknown>>>;
|
||||
|
||||
@@ -390,7 +391,7 @@ export class ChainSummarizationV2 implements INodeType {
|
||||
// In advanced mode user can connect text splitter node so we just retrieve it
|
||||
case 'advanced':
|
||||
textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiTextSplitter,
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as TextSplitter | undefined;
|
||||
break;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HumanMessage } from '@langchain/core/messages';
|
||||
import { ChatPromptTemplate, SystemMessagePromptTemplate } from '@langchain/core/prompts';
|
||||
import type { JSONSchema7 } from 'json-schema';
|
||||
import { OutputFixingParser, StructuredOutputParser } from 'langchain/output_parsers';
|
||||
import { jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
@@ -51,15 +51,15 @@ export class InformationExtractor implements INodeType {
|
||||
name: 'Information Extractor',
|
||||
},
|
||||
inputs: [
|
||||
{ displayName: '', type: NodeConnectionType.Main },
|
||||
{ displayName: '', type: NodeConnectionTypes.Main },
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Text',
|
||||
@@ -222,7 +222,7 @@ export class InformationExtractor implements INodeType {
|
||||
const items = this.getInputData();
|
||||
|
||||
const llm = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import { HumanMessage } from '@langchain/core/messages';
|
||||
import { SystemMessagePromptTemplate, ChatPromptTemplate } from '@langchain/core/prompts';
|
||||
import { OutputFixingParser, StructuredOutputParser } from 'langchain/output_parsers';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
@@ -24,7 +24,7 @@ const configuredOutputs = (parameters: INodeParameters, defaultCategories: strin
|
||||
const categories = (options?.categories as string) ?? defaultCategories;
|
||||
const categoriesArray = categories.split(',').map((cat) => cat.trim());
|
||||
|
||||
const ret = categoriesArray.map((cat) => ({ type: NodeConnectionType.Main, displayName: cat }));
|
||||
const ret = categoriesArray.map((cat) => ({ type: NodeConnectionTypes.Main, displayName: cat }));
|
||||
return ret;
|
||||
};
|
||||
|
||||
@@ -54,11 +54,11 @@ export class SentimentAnalysis implements INodeType {
|
||||
name: 'Sentiment Analysis',
|
||||
},
|
||||
inputs: [
|
||||
{ displayName: '', type: NodeConnectionType.Main },
|
||||
{ displayName: '', type: NodeConnectionTypes.Main },
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
@@ -140,7 +140,7 @@ export class SentimentAnalysis implements INodeType {
|
||||
const items = this.getInputData();
|
||||
|
||||
const llm = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import { HumanMessage } from '@langchain/core/messages';
|
||||
import { SystemMessagePromptTemplate, ChatPromptTemplate } from '@langchain/core/prompts';
|
||||
import { OutputFixingParser, StructuredOutputParser } from 'langchain/output_parsers';
|
||||
import { NodeOperationError, NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
@@ -22,9 +22,9 @@ const configuredOutputs = (parameters: INodeParameters) => {
|
||||
const categories = ((parameters.categories as IDataObject)?.categories as IDataObject[]) ?? [];
|
||||
const fallback = (parameters.options as IDataObject)?.fallback as string;
|
||||
const ret = categories.map((cat) => {
|
||||
return { type: NodeConnectionType.Main, displayName: cat.category };
|
||||
return { type: NodeConnectionTypes.Main, displayName: cat.category };
|
||||
});
|
||||
if (fallback === 'other') ret.push({ type: NodeConnectionType.Main, displayName: 'Other' });
|
||||
if (fallback === 'other') ret.push({ type: NodeConnectionTypes.Main, displayName: 'Other' });
|
||||
return ret;
|
||||
};
|
||||
|
||||
@@ -54,11 +54,11 @@ export class TextClassifier implements INodeType {
|
||||
name: 'Text Classifier',
|
||||
},
|
||||
inputs: [
|
||||
{ displayName: '', type: NodeConnectionType.Main },
|
||||
{ displayName: '', type: NodeConnectionTypes.Main },
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
@@ -167,7 +167,7 @@ export class TextClassifier implements INodeType {
|
||||
const items = this.getInputData();
|
||||
|
||||
const llm = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { makeResolverFromLegacyOptions } from '@n8n/vm2';
|
||||
import { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';
|
||||
import { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';
|
||||
import { standardizeOutput } from 'n8n-nodes-base/dist/nodes/Code/utils';
|
||||
import { NodeOperationError, NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
@@ -24,16 +24,16 @@ const { NODE_FUNCTION_ALLOW_BUILTIN: builtIn, NODE_FUNCTION_ALLOW_EXTERNAL: exte
|
||||
|
||||
// TODO: Replace
|
||||
const connectorTypes = {
|
||||
[NodeConnectionType.AiChain]: 'Chain',
|
||||
[NodeConnectionType.AiDocument]: 'Document',
|
||||
[NodeConnectionType.AiEmbedding]: 'Embedding',
|
||||
[NodeConnectionType.AiLanguageModel]: 'Language Model',
|
||||
[NodeConnectionType.AiMemory]: 'Memory',
|
||||
[NodeConnectionType.AiOutputParser]: 'Output Parser',
|
||||
[NodeConnectionType.AiTextSplitter]: 'Text Splitter',
|
||||
[NodeConnectionType.AiTool]: 'Tool',
|
||||
[NodeConnectionType.AiVectorStore]: 'Vector Store',
|
||||
[NodeConnectionType.Main]: 'Main',
|
||||
[NodeConnectionTypes.AiChain]: 'Chain',
|
||||
[NodeConnectionTypes.AiDocument]: 'Document',
|
||||
[NodeConnectionTypes.AiEmbedding]: 'Embedding',
|
||||
[NodeConnectionTypes.AiLanguageModel]: 'Language Model',
|
||||
[NodeConnectionTypes.AiMemory]: 'Memory',
|
||||
[NodeConnectionTypes.AiOutputParser]: 'Output Parser',
|
||||
[NodeConnectionTypes.AiTextSplitter]: 'Text Splitter',
|
||||
[NodeConnectionTypes.AiTool]: 'Tool',
|
||||
[NodeConnectionTypes.AiVectorStore]: 'Vector Store',
|
||||
[NodeConnectionTypes.Main]: 'Main',
|
||||
};
|
||||
|
||||
const defaultCodeExecute = `const { PromptTemplate } = require('@langchain/core/prompts');
|
||||
@@ -304,7 +304,7 @@ export class Code implements INodeType {
|
||||
|
||||
const outputs = this.getNodeOutputs();
|
||||
const mainOutputs: INodeOutputConfiguration[] = outputs.filter(
|
||||
(output) => output.type === NodeConnectionType.Main,
|
||||
(output) => output.type === NodeConnectionTypes.Main,
|
||||
);
|
||||
|
||||
const options = { multiOutput: mainOutputs.length !== 1 };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { TextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -51,15 +51,15 @@ export class DocumentBinaryInputLoader implements INodeType {
|
||||
{
|
||||
displayName: 'Text Splitter',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiTextSplitter,
|
||||
type: NodeConnectionTypes.AiTextSplitter,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiDocument],
|
||||
outputs: [NodeConnectionTypes.AiDocument],
|
||||
outputNames: ['Document'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Loader Type',
|
||||
name: 'loader',
|
||||
@@ -179,7 +179,7 @@ export class DocumentBinaryInputLoader implements INodeType {
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
this.logger.debug('Supply Data for Binary Input Loader');
|
||||
const textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiTextSplitter,
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as TextSplitter | undefined;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { TextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -49,12 +49,12 @@ export class DocumentDefaultDataLoader implements INodeType {
|
||||
{
|
||||
displayName: 'Text Splitter',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiTextSplitter,
|
||||
type: NodeConnectionTypes.AiTextSplitter,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiDocument],
|
||||
outputs: [NodeConnectionTypes.AiDocument],
|
||||
outputNames: ['Document'],
|
||||
properties: [
|
||||
{
|
||||
@@ -286,7 +286,7 @@ export class DocumentDefaultDataLoader implements INodeType {
|
||||
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const dataType = this.getNodeParameter('dataType', itemIndex, 'json') as 'json' | 'binary';
|
||||
const textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiTextSplitter,
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as TextSplitter | undefined;
|
||||
const binaryDataKey = this.getNodeParameter('binaryDataKey', itemIndex, '') as string;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { GithubRepoLoader } from '@langchain/community/document_loaders/web/github';
|
||||
import type { CharacterTextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -47,15 +47,15 @@ export class DocumentGithubLoader implements INodeType {
|
||||
{
|
||||
displayName: 'Text Splitter',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiTextSplitter,
|
||||
type: NodeConnectionTypes.AiTextSplitter,
|
||||
},
|
||||
],
|
||||
inputNames: ['Text Splitter'],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiDocument],
|
||||
outputs: [NodeConnectionTypes.AiDocument],
|
||||
outputNames: ['Document'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Repository Link',
|
||||
name: 'repository',
|
||||
@@ -106,11 +106,11 @@ export class DocumentGithubLoader implements INodeType {
|
||||
};
|
||||
|
||||
const textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiTextSplitter,
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as CharacterTextSplitter | undefined;
|
||||
|
||||
const { index } = this.addInputData(NodeConnectionType.AiDocument, [
|
||||
const { index } = this.addInputData(NodeConnectionTypes.AiDocument, [
|
||||
[{ json: { repository, branch, ignorePaths, recursive } }],
|
||||
]);
|
||||
const docs = new GithubRepoLoader(repository, {
|
||||
@@ -125,7 +125,7 @@ export class DocumentGithubLoader implements INodeType {
|
||||
? await textSplitter.splitDocuments(await docs.load())
|
||||
: await docs.load();
|
||||
|
||||
this.addOutputData(NodeConnectionType.AiDocument, index, [[{ json: { loadedDocs } }]]);
|
||||
this.addOutputData(NodeConnectionTypes.AiDocument, index, [[{ json: { loadedDocs } }]]);
|
||||
return {
|
||||
response: logWrapper(loadedDocs, this),
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { TextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,15 +44,15 @@ export class DocumentJsonInputLoader implements INodeType {
|
||||
{
|
||||
displayName: 'Text Splitter',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiTextSplitter,
|
||||
type: NodeConnectionTypes.AiTextSplitter,
|
||||
},
|
||||
],
|
||||
inputNames: ['Text Splitter'],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiDocument],
|
||||
outputs: [NodeConnectionTypes.AiDocument],
|
||||
outputNames: ['Document'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Pointers',
|
||||
name: 'pointers',
|
||||
@@ -82,7 +82,7 @@ export class DocumentJsonInputLoader implements INodeType {
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
this.logger.debug('Supply Data for JSON Input Loader');
|
||||
const textSplitter = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiTextSplitter,
|
||||
NodeConnectionTypes.AiTextSplitter,
|
||||
0,
|
||||
)) as TextSplitter | undefined;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { BedrockEmbeddings } from '@langchain/aws';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -45,14 +45,14 @@ export class EmbeddingsAwsBedrock implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
baseURL: '=https://bedrock.{{$credentials?.region ?? "eu-central-1"}}.amazonaws.com',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { OpenAIEmbeddings } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -45,10 +45,10 @@ export class EmbeddingsAzureOpenAi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Model (Deployment) Name',
|
||||
name: 'model',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { CohereEmbeddings } from '@langchain/cohere';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -48,10 +48,10 @@ export class EmbeddingsCohere implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName:
|
||||
'Each model is using different dimensional density for embeddings. Please make sure to use the same dimensionality for your vector store. The default model is using 768-dimensional embeddings.',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { GoogleGenerativeAIEmbeddings } from '@langchain/google-genai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -48,10 +48,10 @@ export class EmbeddingsGoogleGemini implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName:
|
||||
'Each model is using different dimensional density for embeddings. Please make sure to use the same dimensionality for your vector store. The default model is using 768-dimensional embeddings.',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { HuggingFaceInferenceEmbeddings } from '@langchain/community/embeddings/hf';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,10 +44,10 @@ export class EmbeddingsHuggingFaceInference implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName:
|
||||
'Each model is using different dimensional density for embeddings. Please make sure to use the same dimensionality for your vector store. The default model is using 768-dimensional embeddings.',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { MistralAIEmbeddingsParams } from '@langchain/mistralai';
|
||||
import { MistralAIEmbeddings } from '@langchain/mistralai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -46,14 +46,14 @@ export class EmbeddingsMistralCloud implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
baseURL: 'https://api.mistral.ai/v1',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { OllamaEmbeddings } from '@langchain/ollama';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -41,9 +41,9 @@ export class EmbeddingsOllama implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]), ollamaModel],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]), ollamaModel],
|
||||
};
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { OpenAIEmbeddings } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type SupplyData,
|
||||
@@ -101,7 +101,7 @@ export class EmbeddingsOpenAi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiEmbedding],
|
||||
outputs: [NodeConnectionTypes.AiEmbedding],
|
||||
outputNames: ['Embeddings'],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
@@ -109,7 +109,7 @@ export class EmbeddingsOpenAi implements INodeType {
|
||||
'={{ $parameter.options?.baseURL?.split("/").slice(0,-1).join("/") || $credentials.url?.split("/").slice(0,-1).join("/") || "https://api.openai.com" }}',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),
|
||||
{
|
||||
...modelParameter,
|
||||
default: 'text-embedding-ada-002',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { ChatAnthropic } from '@langchain/anthropic';
|
||||
import type { LLMResult } from '@langchain/core/outputs';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodePropertyOptions,
|
||||
type INodeProperties,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -109,7 +109,7 @@ export class LmChatAnthropic implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -118,7 +118,7 @@ export class LmChatAnthropic implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiChain]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),
|
||||
{
|
||||
...modelField,
|
||||
displayOptions: {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { ChatOllamaInput } from '@langchain/ollama';
|
||||
import { ChatOllama } from '@langchain/ollama';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -45,11 +45,11 @@ export class LmChatOllama implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
...ollamaDescription,
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
ollamaModel,
|
||||
ollamaOptions,
|
||||
],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ChatOpenAI, type ClientOptions } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -51,7 +51,7 @@ export class LmChatOpenAi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -65,7 +65,7 @@ export class LmChatOpenAi implements INodeType {
|
||||
'={{ $parameter.options?.baseURL?.split("/").slice(0,-1).join("/") || $credentials?.url?.split("/").slice(0,-1).join("/") || "https://api.openai.com" }}',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'If using JSON response format, you must include word "json" in the prompt in your chain or agent. Also, make sure to select latest models released post November 2023.',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { Cohere } from '@langchain/cohere';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class LmCohere implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -51,7 +51,7 @@ export class LmCohere implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Ollama } from '@langchain/community/llms/ollama';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,11 +44,11 @@ export class LmOllama implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
...ollamaDescription,
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
ollamaModel,
|
||||
ollamaOptions,
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { OpenAI, type ClientOptions } from '@langchain/openai';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
@@ -53,7 +53,7 @@ export class LmOpenAi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { HuggingFaceInference } from '@langchain/community/llms/hf';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class LmOpenHuggingFaceInference implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -51,7 +51,7 @@ export class LmOpenHuggingFaceInference implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { ChatBedrockConverse } from '@langchain/aws';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class LmChatAwsBedrock implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -56,7 +56,7 @@ export class LmChatAwsBedrock implements INodeType {
|
||||
baseURL: '=https://bedrock.{{$credentials?.region ?? "eu-central-1"}}.amazonaws.com',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiChain]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { AzureChatOpenAI } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class LmChatAzureOpenAi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -51,7 +51,7 @@ export class LmChatAzureOpenAi implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'If using JSON response format, you must include word "json" in the prompt in your chain or agent. Also, make sure to select latest models released post November 2023.',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ChatOpenAI, type ClientOptions } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,7 +44,7 @@ export class LmChatDeepSeek implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -57,7 +57,7 @@ export class LmChatDeepSeek implements INodeType {
|
||||
baseURL: '={{ $credentials?.url }}',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'If using JSON response format, you must include word "json" in the prompt in your chain or agent. Also, make sure to select latest models released post November 2023.',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { SafetySetting } from '@google/generative-ai';
|
||||
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
NodeError,
|
||||
INodeType,
|
||||
@@ -52,7 +52,7 @@ export class LmChatGoogleGemini implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -65,7 +65,7 @@ export class LmChatGoogleGemini implements INodeType {
|
||||
baseURL: '={{ $credentials.host }}',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'modelName',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ProjectsClient } from '@google-cloud/resource-manager';
|
||||
import { ChatVertexAI } from '@langchain/google-vertexai';
|
||||
import { formatPrivateKey } from 'n8n-nodes-base/dist/utils/utilities';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -50,7 +50,7 @@ export class LmChatGoogleVertex implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -59,7 +59,7 @@ export class LmChatGoogleVertex implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Project ID',
|
||||
name: 'projectId',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { ChatGroq } from '@langchain/groq';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class LmChatGroq implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -54,7 +54,7 @@ export class LmChatGroq implements INodeType {
|
||||
baseURL: 'https://api.groq.com/openai/v1',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiChain]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { ChatMistralAIInput } from '@langchain/mistralai';
|
||||
import { ChatMistralAI } from '@langchain/mistralai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,7 +44,7 @@ export class LmChatMistralCloud implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -57,7 +57,7 @@ export class LmChatMistralCloud implements INodeType {
|
||||
baseURL: 'https://api.mistral.ai/v1',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ChatOpenAI, type ClientOptions } from '@langchain/openai';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -43,7 +43,7 @@ export class LmChatOpenRouter implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiLanguageModel],
|
||||
outputs: [NodeConnectionTypes.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -56,7 +56,7 @@ export class LmChatOpenRouter implements INodeType {
|
||||
baseURL: '={{ $credentials?.url }}',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'If using JSON response format, you must include word "json" in the prompt in your chain or agent. Also, make sure to select latest models released post November 2023.',
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { LLMResult } from '@langchain/core/outputs';
|
||||
import { encodingForModel } from '@langchain/core/utils/tiktoken';
|
||||
import { pick } from 'lodash';
|
||||
import type { IDataObject, ISupplyDataFunctions, JsonObject } from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeError, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { logAiEvent } from '@utils/helpers';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class N8nLlmTracing extends BaseCallbackHandler {
|
||||
// This is crucial for the handleLLMError handler to work correctly (it should be called before the error is propagated to the root node)
|
||||
awaitHandlers = true;
|
||||
|
||||
connectionType = NodeConnectionType.AiLanguageModel;
|
||||
connectionType = NodeConnectionTypes.AiLanguageModel;
|
||||
|
||||
promptTokensEstimate = 0;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { BufferWindowMemoryInput } from 'langchain/memory';
|
||||
import { BufferWindowMemory } from 'langchain/memory';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -101,10 +101,10 @@ export class MemoryBufferWindow implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Session Key',
|
||||
name: 'sessionKey',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type IDataObject,
|
||||
type IExecuteFunctions,
|
||||
type INodeExecutionData,
|
||||
@@ -61,16 +61,16 @@ export class MemoryChatRetriever implements INodeType {
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Memory',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: NodeConnectionTypes.AiMemory,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: "This node is deprecated. Use 'Chat Memory Manager' node instead.",
|
||||
@@ -91,7 +91,7 @@ export class MemoryChatRetriever implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
this.logger.debug('Executing Chat Memory Retriever');
|
||||
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
const memory = (await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
const simplifyOutput = this.getNodeParameter('simplifyOutput', 0) as boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import { AIMessage, SystemMessage, HumanMessage, type BaseMessage } from '@langchain/core/messages';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
@@ -92,11 +92,11 @@ export class MemoryManager implements INodeType {
|
||||
inputs: [
|
||||
{
|
||||
displayName: '',
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
},
|
||||
{
|
||||
displayName: 'Memory',
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: NodeConnectionTypes.AiMemory,
|
||||
required: true,
|
||||
maxConnections: 1,
|
||||
},
|
||||
@@ -105,7 +105,7 @@ export class MemoryManager implements INodeType {
|
||||
outputs: [
|
||||
{
|
||||
displayName: '',
|
||||
type: NodeConnectionType.Main,
|
||||
type: NodeConnectionTypes.Main,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
@@ -297,7 +297,7 @@ export class MemoryManager implements INodeType {
|
||||
const items = this.getInputData();
|
||||
const mode = this.getNodeParameter('mode', 0, 'load') as 'load' | 'insert' | 'delete';
|
||||
const memory = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiMemory,
|
||||
NodeConnectionTypes.AiMemory,
|
||||
0,
|
||||
)) as BaseChatMemory;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { MotorheadMemory } from '@langchain/community/memory/motorhead_memory';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -42,7 +42,7 @@ export class MemoryMotorhead implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -51,7 +51,7 @@ export class MemoryMotorhead implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Session ID',
|
||||
name: 'sessionId',
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
INodeTypeDescription,
|
||||
SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type pg from 'pg';
|
||||
|
||||
import { getSessionId } from '@utils/helpers';
|
||||
@@ -58,10 +58,10 @@ export class MemoryPostgresChat implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
sessionIdOption,
|
||||
expressionSessionKeyProperty(1.2),
|
||||
sessionKeyProperty,
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
import type { RedisClientOptions } from 'redis';
|
||||
import { createClient } from 'redis';
|
||||
@@ -57,10 +57,10 @@ export class MemoryRedisChat implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Session Key',
|
||||
name: 'sessionKey',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { XataChatMessageHistory } from '@langchain/community/stores/message/xata';
|
||||
import { BaseClient } from '@xata.io/client';
|
||||
import { BufferMemory, BufferWindowMemory } from 'langchain/memory';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
ISupplyDataFunctions,
|
||||
INodeType,
|
||||
@@ -50,7 +50,7 @@ export class MemoryXata implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -59,7 +59,7 @@ export class MemoryXata implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Session ID',
|
||||
name: 'sessionId',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ZepCloudMemory } from '@langchain/community/memory/zep_cloud';
|
||||
import type { InputValues, MemoryVariables } from '@langchain/core/memory';
|
||||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type ISupplyDataFunctions,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
@@ -58,7 +58,7 @@ export class MemoryZep implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiMemory],
|
||||
outputs: [NodeConnectionTypes.AiMemory],
|
||||
outputNames: ['Memory'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -67,7 +67,7 @@ export class MemoryZep implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Only works with Zep Cloud and Community edition <= v0.27.2',
|
||||
name: 'supportedVersions',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
ISupplyDataFunctions,
|
||||
INodeType,
|
||||
@@ -47,18 +47,18 @@ export class OutputParserAutofixing implements INodeType {
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Output Parser',
|
||||
maxConnections: 1,
|
||||
required: true,
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: NodeConnectionTypes.AiOutputParser,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiOutputParser],
|
||||
outputs: [NodeConnectionTypes.AiOutputParser],
|
||||
outputNames: ['Output Parser'],
|
||||
properties: [
|
||||
{
|
||||
@@ -68,7 +68,7 @@ export class OutputParserAutofixing implements INodeType {
|
||||
type: 'notice',
|
||||
default: '',
|
||||
},
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
@@ -95,11 +95,11 @@ export class OutputParserAutofixing implements INodeType {
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
itemIndex,
|
||||
)) as BaseLanguageModel;
|
||||
const outputParser = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiOutputParser,
|
||||
NodeConnectionTypes.AiOutputParser,
|
||||
itemIndex,
|
||||
)) as N8nStructuredOutputParser;
|
||||
const prompt = this.getNodeParameter('options.prompt', itemIndex, NAIVE_FIX_PROMPT) as string;
|
||||
|
||||
@@ -5,8 +5,12 @@ import { OutputParserException } from '@langchain/core/output_parsers';
|
||||
import type { MockProxy } from 'jest-mock-extended';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { normalizeItems } from 'n8n-core';
|
||||
import type { ISupplyDataFunctions, IWorkflowDataProxyData } from 'n8n-workflow';
|
||||
import { ApplicationError, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
ISupplyDataFunctions,
|
||||
IWorkflowDataProxyData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type {
|
||||
N8nOutputFixingParser,
|
||||
@@ -34,8 +38,8 @@ describe('OutputParserAutofixing', () => {
|
||||
thisArg.addInputData.mockReturnValue({ index: 0 });
|
||||
thisArg.addOutputData.mockReturnValue();
|
||||
thisArg.getInputConnectionData.mockImplementation(async (type: NodeConnectionType) => {
|
||||
if (type === NodeConnectionType.AiLanguageModel) return mockModel;
|
||||
if (type === NodeConnectionType.AiOutputParser) return mockStructuredOutputParser;
|
||||
if (type === NodeConnectionTypes.AiLanguageModel) return mockModel;
|
||||
if (type === NodeConnectionTypes.AiOutputParser) return mockStructuredOutputParser;
|
||||
|
||||
throw new ApplicationError('Unexpected connection type');
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -39,10 +39,10 @@ export class OutputParserItemList implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiOutputParser],
|
||||
outputs: [NodeConnectionTypes.AiOutputParser],
|
||||
outputNames: ['Output Parser'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
NodeOperationError,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
import type { z } from 'zod';
|
||||
|
||||
@@ -46,10 +46,10 @@ export class OutputParserStructured implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiOutputParser],
|
||||
outputs: [NodeConnectionTypes.AiOutputParser],
|
||||
outputNames: ['Output Parser'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiAgent]),
|
||||
{ ...schemaTypeField, displayOptions: { show: { '@version': [{ _cnd: { gte: 1.2 } }] } } },
|
||||
{
|
||||
...jsonSchemaExampleField,
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression';
|
||||
import { LLMChainExtractor } from 'langchain/retrievers/document_compressors/chain_extract';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,13 +44,13 @@ export class RetrieverContextualCompression implements INodeType {
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
@@ -58,7 +58,7 @@ export class RetrieverContextualCompression implements INodeType {
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
},
|
||||
],
|
||||
properties: [],
|
||||
@@ -68,12 +68,12 @@ export class RetrieverContextualCompression implements INodeType {
|
||||
this.logger.debug('Supplying data for Contextual Compression Retriever');
|
||||
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
itemIndex,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
const baseRetriever = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiRetriever,
|
||||
NodeConnectionTypes.AiRetriever,
|
||||
itemIndex,
|
||||
)) as BaseRetriever;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||
import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||
import { MultiQueryRetriever } from 'langchain/retrievers/multi_query';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -44,13 +44,13 @@ export class RetrieverMultiQuery implements INodeType {
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
@@ -58,7 +58,7 @@ export class RetrieverMultiQuery implements INodeType {
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
@@ -89,12 +89,12 @@ export class RetrieverMultiQuery implements INodeType {
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as { queryCount?: number };
|
||||
|
||||
const model = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
itemIndex,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
const baseRetriever = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiRetriever,
|
||||
NodeConnectionTypes.AiRetriever,
|
||||
itemIndex,
|
||||
)) as BaseRetriever;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -40,12 +40,12 @@ export class RetrieverVectorStore implements INodeType {
|
||||
{
|
||||
displayName: 'Vector Store',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiVectorStore,
|
||||
type: NodeConnectionTypes.AiVectorStore,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiRetriever],
|
||||
outputs: [NodeConnectionTypes.AiRetriever],
|
||||
outputNames: ['Retriever'],
|
||||
properties: [
|
||||
{
|
||||
@@ -63,7 +63,7 @@ export class RetrieverVectorStore implements INodeType {
|
||||
|
||||
const topK = this.getNodeParameter('topK', itemIndex, 4) as number;
|
||||
const vectorStore = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiVectorStore,
|
||||
NodeConnectionTypes.AiVectorStore,
|
||||
itemIndex,
|
||||
)) as VectorStore;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Document } from '@langchain/core/documents';
|
||||
import { BaseRetriever, type BaseRetrieverInput } from '@langchain/core/retrievers';
|
||||
import type { SetField, SetNodeOptions } from 'n8n-nodes-base/dist/nodes/Set/v2/helpers/interfaces';
|
||||
import * as manual from 'n8n-nodes-base/dist/nodes/Set/v2/manual.mode';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteWorkflowInfo,
|
||||
@@ -66,7 +66,7 @@ export class RetrieverWorkflow implements INodeType {
|
||||
{
|
||||
displayName: 'Retriever',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiRetriever,
|
||||
type: NodeConnectionTypes.AiRetriever,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { CharacterTextSplitterParams } from '@langchain/textsplitters';
|
||||
import { CharacterTextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -40,10 +40,10 @@ export class TextSplitterCharacterTextSplitter implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTextSplitter],
|
||||
outputs: [NodeConnectionTypes.AiTextSplitter],
|
||||
outputNames: ['Text Splitter'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiDocument]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiDocument]),
|
||||
{
|
||||
displayName: 'Separator',
|
||||
name: 'separator',
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
} from '@langchain/textsplitters';
|
||||
import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -60,10 +60,10 @@ export class TextSplitterRecursiveCharacterTextSplitter implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTextSplitter],
|
||||
outputs: [NodeConnectionTypes.AiTextSplitter],
|
||||
outputNames: ['Text Splitter'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiDocument]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiDocument]),
|
||||
{
|
||||
displayName: 'Chunk Size',
|
||||
name: 'chunkSize',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { TokenTextSplitter } from '@langchain/textsplitters';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -39,10 +39,10 @@ export class TextSplitterTokenSplitter implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTextSplitter],
|
||||
outputs: [NodeConnectionTypes.AiTextSplitter],
|
||||
outputNames: ['Text Splitter'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiDocument]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiDocument]),
|
||||
{
|
||||
displayName: 'Chunk Size',
|
||||
name: 'chunkSize',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { Calculator } from '@langchain/community/tools/calculator';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -40,9 +40,9 @@ export class ToolCalculator implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionType.AiAgent])],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],
|
||||
};
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
ExecutionError,
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { jsonParse, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
buildInputSchemaField,
|
||||
@@ -54,10 +54,10 @@ export class ToolCode implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'See an example of a conversational agent with custom tool written in JavaScript <a href="/templates/1963" target="_blank">here</a>.',
|
||||
@@ -221,7 +221,7 @@ export class ToolCode implements INodeType {
|
||||
};
|
||||
|
||||
const toolHandler = async (query: string | IDataObject): Promise<string> => {
|
||||
const { index } = this.addInputData(NodeConnectionType.AiTool, [[{ json: { query } }]]);
|
||||
const { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);
|
||||
|
||||
let response: string = '';
|
||||
let executionError: ExecutionError | undefined;
|
||||
@@ -245,9 +245,9 @@ export class ToolCode implements INodeType {
|
||||
}
|
||||
|
||||
if (executionError) {
|
||||
void this.addOutputData(NodeConnectionType.AiTool, index, executionError);
|
||||
void this.addOutputData(NodeConnectionTypes.AiTool, index, executionError);
|
||||
} else {
|
||||
void this.addOutputData(NodeConnectionType.AiTool, index, [[{ json: { response } }]]);
|
||||
void this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -8,7 +8,11 @@ import type {
|
||||
IHttpRequestMethods,
|
||||
IHttpRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError, tryToParseAlphanumericString } from 'n8n-workflow';
|
||||
import {
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
tryToParseAlphanumericString,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { N8nTool } from '@utils/N8nTool';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
@@ -62,10 +66,10 @@ export class ToolHttpRequest implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'toolDescription',
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
NodeApiError,
|
||||
ISupplyDataFunctions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||
import { z } from 'zod';
|
||||
|
||||
import type {
|
||||
@@ -585,7 +585,7 @@ export const configureToolFunction = (
|
||||
optimizeResponse: (response: string) => string,
|
||||
) => {
|
||||
return async (query: string | IDataObject): Promise<string> => {
|
||||
const { index } = ctx.addInputData(NodeConnectionType.AiTool, [[{ json: { query } }]]);
|
||||
const { index } = ctx.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);
|
||||
|
||||
// Clone options and rawRequestOptions to avoid mutating the original objects
|
||||
const options: IHttpRequestOptions | null = structuredClone(requestOptions);
|
||||
@@ -792,9 +792,9 @@ export const configureToolFunction = (
|
||||
}
|
||||
|
||||
if (executionError) {
|
||||
void ctx.addOutputData(NodeConnectionType.AiTool, index, executionError as ExecutionError);
|
||||
void ctx.addOutputData(NodeConnectionTypes.AiTool, index, executionError as ExecutionError);
|
||||
} else {
|
||||
void ctx.addOutputData(NodeConnectionType.AiTool, index, [[{ json: { response } }]]);
|
||||
void ctx.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json: { response } }]]);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { SerpAPI } from '@langchain/community/tools/serpapi';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -39,7 +39,7 @@ export class ToolSerpApi implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
credentials: [
|
||||
{
|
||||
@@ -48,7 +48,7 @@ export class ToolSerpApi implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
ISupplyDataFunctions,
|
||||
SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
@@ -44,21 +44,21 @@ export class ToolVectorStore implements INodeType {
|
||||
{
|
||||
displayName: 'Vector Store',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiVectorStore,
|
||||
type: NodeConnectionTypes.AiVectorStore,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: NodeConnectionTypes.AiLanguageModel,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName: 'Data Name',
|
||||
name: 'name',
|
||||
@@ -97,12 +97,12 @@ export class ToolVectorStore implements INodeType {
|
||||
const topK = this.getNodeParameter('topK', itemIndex, 4) as number;
|
||||
|
||||
const vectorStore = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiVectorStore,
|
||||
NodeConnectionTypes.AiVectorStore,
|
||||
itemIndex,
|
||||
)) as VectorStore;
|
||||
|
||||
const llm = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionTypes.AiLanguageModel,
|
||||
0,
|
||||
)) as BaseLanguageModel;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { WikipediaQueryRun } from '@langchain/community/tools/wikipedia_query_run';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -39,9 +39,9 @@ export class ToolWikipedia implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionType.AiAgent])],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],
|
||||
};
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { WolframAlphaTool } from '@langchain/community/tools/wolframalpha';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -45,9 +45,9 @@ export class ToolWolframAlpha implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionType.AiAgent])],
|
||||
properties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],
|
||||
};
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
ITaskMetadata,
|
||||
INodeTypeBaseDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||
|
||||
import { versionDescription } from './versionDescription';
|
||||
import type { DynamicZodObject } from '../../../../types/zod.types';
|
||||
@@ -148,7 +148,7 @@ export class ToolWorkflowV1 implements INodeType {
|
||||
query: string | IDataObject,
|
||||
runManager?: CallbackManagerForToolRun,
|
||||
): Promise<string> => {
|
||||
const { index } = this.addInputData(NodeConnectionType.AiTool, [[{ json: { query } }]]);
|
||||
const { index } = this.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);
|
||||
|
||||
let response: string = '';
|
||||
let executionError: ExecutionError | undefined;
|
||||
@@ -189,12 +189,12 @@ export class ToolWorkflowV1 implements INodeType {
|
||||
}
|
||||
|
||||
if (executionError) {
|
||||
void this.addOutputData(NodeConnectionType.AiTool, index, executionError, metadata);
|
||||
void this.addOutputData(NodeConnectionTypes.AiTool, index, executionError, metadata);
|
||||
} else {
|
||||
// Output always needs to be an object
|
||||
// so we try to parse the response as JSON and if it fails we just return the string wrapped in an object
|
||||
const json = jsonParse<IDataObject>(response, { fallbackValue: { response } });
|
||||
void this.addOutputData(NodeConnectionType.AiTool, index, [[{ json }]], metadata);
|
||||
void this.addOutputData(NodeConnectionTypes.AiTool, index, [[{ json }]], metadata);
|
||||
}
|
||||
return response;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
inputSchemaField,
|
||||
@@ -36,10 +36,10 @@ export const versionDescription: INodeTypeDescription = {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [],
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'See an example of a workflow to suggest meeting slots using AI <a href="/templates/1953" target="_blank">here</a>.',
|
||||
|
||||
@@ -21,7 +21,7 @@ import type {
|
||||
import {
|
||||
generateZodSchema,
|
||||
jsonParse,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
parseErrorMetadata,
|
||||
traverseNodeParameters,
|
||||
@@ -113,7 +113,7 @@ export class WorkflowToolService {
|
||||
}
|
||||
|
||||
void context.addOutputData(
|
||||
NodeConnectionType.AiTool,
|
||||
NodeConnectionTypes.AiTool,
|
||||
localRunIndex,
|
||||
[responseData],
|
||||
metadata,
|
||||
@@ -126,7 +126,7 @@ export class WorkflowToolService {
|
||||
|
||||
const metadata = parseErrorMetadata(error);
|
||||
void context.addOutputData(
|
||||
NodeConnectionType.AiTool,
|
||||
NodeConnectionTypes.AiTool,
|
||||
localRunIndex,
|
||||
executionError,
|
||||
metadata,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import { NodeConnectionType, type INodeTypeDescription } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, type INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import { getConnectionHintNoticeField } from '../../../../utils/sharedFields';
|
||||
|
||||
@@ -14,10 +14,10 @@ export const versionDescription: INodeTypeDescription = {
|
||||
},
|
||||
version: [2, 2.1],
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionType.AiTool],
|
||||
outputs: [NodeConnectionTypes.AiTool],
|
||||
outputNames: ['Tool'],
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiAgent]),
|
||||
getConnectionHintNoticeField([NodeConnectionTypes.AiAgent]),
|
||||
{
|
||||
displayName:
|
||||
'See an example of a workflow to suggest meeting slots using AI <a href="/templates/1953" target="_blank">here</a>.',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||
import { pick } from 'lodash';
|
||||
import { Node, NodeConnectionType } from 'n8n-workflow';
|
||||
import { Node, NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IWebhookFunctions,
|
||||
@@ -70,12 +70,12 @@ export class ChatTrigger extends Node {
|
||||
{
|
||||
displayName: 'Memory',
|
||||
maxConnections: 1,
|
||||
type: '${NodeConnectionType.AiMemory}',
|
||||
type: '${NodeConnectionTypes.AiMemory}',
|
||||
required: true,
|
||||
}
|
||||
];
|
||||
})() }}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
|
||||
@@ -554,7 +554,7 @@ ${cssVariables}
|
||||
|
||||
if (bodyData.action === 'loadPreviousSession') {
|
||||
if (options?.loadPreviousSession === 'memory') {
|
||||
const memory = (await ctx.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
const memory = (await ctx.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BaseChatMemory
|
||||
| undefined;
|
||||
const messages = ((await memory?.chatHistory.getMessages()) ?? [])
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ITriggerResponse,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class ManualChatTrigger implements INodeType {
|
||||
@@ -35,7 +35,7 @@ export class ManualChatTrigger implements INodeType {
|
||||
},
|
||||
},
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from 'langchain/document';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeExecutionData,
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
@@ -42,21 +42,21 @@ export class VectorStoreInMemoryInsert implements INodeType {
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Document',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: NodeConnectionTypes.AiDocument,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName:
|
||||
@@ -86,13 +86,13 @@ export class VectorStoreInMemoryInsert implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData(0);
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
const memoryKey = this.getNodeParameter('memoryKey', 0) as string;
|
||||
const clearStore = this.getNodeParameter('clearStore', 0) as boolean;
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -43,11 +43,11 @@ export class VectorStoreInMemoryLoad implements INodeType {
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.AiVectorStore],
|
||||
outputs: [NodeConnectionTypes.AiVectorStore],
|
||||
outputNames: ['Vector Store'],
|
||||
properties: [
|
||||
{
|
||||
@@ -63,7 +63,7 @@ export class VectorStoreInMemoryLoad implements INodeType {
|
||||
|
||||
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
itemIndex,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
@@ -51,21 +51,21 @@ export class VectorStorePineconeInsert implements INodeType {
|
||||
},
|
||||
],
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Document',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: NodeConnectionTypes.AiDocument,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
pineconeIndexRLC,
|
||||
{
|
||||
@@ -106,12 +106,12 @@ export class VectorStorePineconeInsert implements INodeType {
|
||||
|
||||
const credentials = await this.getCredentials('pineconeApi');
|
||||
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||
import { PineconeStore } from '@langchain/pinecone';
|
||||
import { Pinecone } from '@pinecone-database/pinecone';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -54,11 +54,11 @@ export class VectorStorePineconeLoad implements INodeType {
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.AiVectorStore],
|
||||
outputs: [NodeConnectionTypes.AiVectorStore],
|
||||
outputNames: ['Vector Store'],
|
||||
properties: [
|
||||
pineconeIndexRLC,
|
||||
@@ -95,7 +95,7 @@ export class VectorStorePineconeLoad implements INodeType {
|
||||
|
||||
const credentials = await this.getCredentials('pineconeApi');
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
itemIndex,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
@@ -51,21 +51,21 @@ export class VectorStoreSupabaseInsert implements INodeType {
|
||||
},
|
||||
],
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Document',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: NodeConnectionTypes.AiDocument,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName:
|
||||
@@ -102,12 +102,12 @@ export class VectorStoreSupabaseInsert implements INodeType {
|
||||
const queryName = this.getNodeParameter('queryName', 0) as string;
|
||||
const credentials = await this.getCredentials('supabaseApi');
|
||||
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
const client = createClient(credentials.host as string, credentials.serviceRole as string);
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||
@@ -54,11 +54,11 @@ export class VectorStoreSupabaseLoad implements INodeType {
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.AiVectorStore],
|
||||
outputs: [NodeConnectionTypes.AiVectorStore],
|
||||
outputNames: ['Vector Store'],
|
||||
properties: [
|
||||
supabaseTableNameRLC,
|
||||
@@ -93,7 +93,7 @@ export class VectorStoreSupabaseLoad implements INodeType {
|
||||
|
||||
const credentials = await this.getCredentials('supabaseApi');
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
@@ -47,21 +47,21 @@ export class VectorStoreZepInsert implements INodeType {
|
||||
},
|
||||
],
|
||||
inputs: [
|
||||
NodeConnectionType.Main,
|
||||
NodeConnectionTypes.Main,
|
||||
{
|
||||
displayName: 'Document',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: NodeConnectionTypes.AiDocument,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Collection Name',
|
||||
@@ -117,12 +117,12 @@ export class VectorStoreZepInsert implements INodeType {
|
||||
apiUrl: string;
|
||||
}>('zepApi');
|
||||
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await this.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type ISupplyDataFunctions,
|
||||
@@ -50,11 +50,11 @@ export class VectorStoreZepLoad implements INodeType {
|
||||
{
|
||||
displayName: 'Embedding',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiEmbedding,
|
||||
type: NodeConnectionTypes.AiEmbedding,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
outputs: [NodeConnectionType.AiVectorStore],
|
||||
outputs: [NodeConnectionTypes.AiVectorStore],
|
||||
outputNames: ['Vector Store'],
|
||||
properties: [
|
||||
{
|
||||
@@ -99,7 +99,7 @@ export class VectorStoreZepLoad implements INodeType {
|
||||
apiUrl: string;
|
||||
}>('zepApi');
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { DEFAULT_OPERATION_MODES } from '../constants';
|
||||
import type { VectorStoreNodeConstructorArgs, NodeOperationMode } from '../types';
|
||||
@@ -178,8 +178,8 @@ describe('Vector Store Utilities', () => {
|
||||
const retrieveOption = result.find((option) => option.value === 'retrieve');
|
||||
const retrieveAsToolOption = result.find((option) => option.value === 'retrieve-as-tool');
|
||||
|
||||
expect(retrieveOption?.outputConnectionType).toBe(NodeConnectionType.AiVectorStore);
|
||||
expect(retrieveAsToolOption?.outputConnectionType).toBe(NodeConnectionType.AiTool);
|
||||
expect(retrieveOption?.outputConnectionType).toBe(NodeConnectionTypes.AiVectorStore);
|
||||
expect(retrieveAsToolOption?.outputConnectionType).toBe(NodeConnectionTypes.AiTool);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
import type { INodePropertyOptions } from 'n8n-workflow';
|
||||
|
||||
import type { NodeOperationMode } from './types';
|
||||
@@ -28,14 +28,14 @@ export const OPERATION_MODE_DESCRIPTIONS: INodePropertyOptions[] = [
|
||||
value: 'retrieve',
|
||||
description: 'Retrieve documents from vector store to be used as vector store with AI nodes',
|
||||
action: 'Retrieve documents for Chain/Tool as Vector Store',
|
||||
outputConnectionType: NodeConnectionType.AiVectorStore,
|
||||
outputConnectionType: NodeConnectionTypes.AiVectorStore,
|
||||
},
|
||||
{
|
||||
name: 'Retrieve Documents (As Tool for AI Agent)',
|
||||
value: 'retrieve-as-tool',
|
||||
description: 'Retrieve documents from vector store to be used as tool with AI nodes',
|
||||
action: 'Retrieve documents for AI Agent as Tool',
|
||||
outputConnectionType: NodeConnectionType.AiTool,
|
||||
outputConnectionType: NodeConnectionTypes.AiTool,
|
||||
},
|
||||
{
|
||||
name: 'Update Documents',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
@@ -66,18 +66,18 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
|
||||
inputs: `={{
|
||||
((parameters) => {
|
||||
const mode = parameters?.mode;
|
||||
const inputs = [{ displayName: "Embedding", type: "${NodeConnectionType.AiEmbedding}", required: true, maxConnections: 1}]
|
||||
const inputs = [{ displayName: "Embedding", type: "${NodeConnectionTypes.AiEmbedding}", required: true, maxConnections: 1}]
|
||||
|
||||
if (mode === 'retrieve-as-tool') {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
if (['insert', 'load', 'update'].includes(mode)) {
|
||||
inputs.push({ displayName: "", type: "${NodeConnectionType.Main}"})
|
||||
inputs.push({ displayName: "", type: "${NodeConnectionTypes.Main}"})
|
||||
}
|
||||
|
||||
if (['insert'].includes(mode)) {
|
||||
inputs.push({ displayName: "Document", type: "${NodeConnectionType.AiDocument}", required: true, maxConnections: 1})
|
||||
inputs.push({ displayName: "Document", type: "${NodeConnectionTypes.AiDocument}", required: true, maxConnections: 1})
|
||||
}
|
||||
return inputs
|
||||
})($parameter)
|
||||
@@ -87,13 +87,13 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
|
||||
const mode = parameters?.mode ?? 'retrieve';
|
||||
|
||||
if (mode === 'retrieve-as-tool') {
|
||||
return [{ displayName: "Tool", type: "${NodeConnectionType.AiTool}"}]
|
||||
return [{ displayName: "Tool", type: "${NodeConnectionTypes.AiTool}"}]
|
||||
}
|
||||
|
||||
if (mode === 'retrieve') {
|
||||
return [{ displayName: "Vector Store", type: "${NodeConnectionType.AiVectorStore}"}]
|
||||
return [{ displayName: "Vector Store", type: "${NodeConnectionTypes.AiVectorStore}"}]
|
||||
}
|
||||
return [{ displayName: "", type: "${NodeConnectionType.Main}"}]
|
||||
return [{ displayName: "", type: "${NodeConnectionTypes.Main}"}]
|
||||
})($parameter)
|
||||
}}`,
|
||||
properties: [
|
||||
@@ -106,7 +106,7 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
|
||||
options: getOperationModeOptions(args),
|
||||
},
|
||||
{
|
||||
...getConnectionHintNoticeField([NodeConnectionType.AiRetriever]),
|
||||
...getConnectionHintNoticeField([NodeConnectionTypes.AiRetriever]),
|
||||
displayOptions: {
|
||||
show: {
|
||||
mode: ['retrieve'],
|
||||
@@ -232,7 +232,7 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
|
||||
|
||||
// Get the embeddings model connected to this node
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
@@ -274,7 +274,7 @@ export const createVectorStoreNode = <T extends VectorStore = VectorStore>(
|
||||
|
||||
// Get the embeddings model connected to this node
|
||||
const embeddings = (await this.getInputConnectionData(
|
||||
NodeConnectionType.AiEmbedding,
|
||||
NodeConnectionTypes.AiEmbedding,
|
||||
0,
|
||||
)) as Embeddings;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import type { MockProxy } from 'jest-mock-extended';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { logAiEvent } from '@utils/helpers';
|
||||
import type { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||
@@ -137,7 +137,7 @@ describe('handleInsertOperation', () => {
|
||||
|
||||
// Should get document input from connection
|
||||
expect(mockContext.getInputConnectionData).toHaveBeenCalledWith(
|
||||
NodeConnectionType.AiDocument,
|
||||
NodeConnectionTypes.AiDocument,
|
||||
0,
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Document } from '@langchain/core/documents';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { logAiEvent } from '@utils/helpers';
|
||||
import type { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||
@@ -23,7 +23,7 @@ export async function handleInsertOperation<T extends VectorStore = VectorStore>
|
||||
const nodeVersion = context.getNode().typeVersion;
|
||||
// Get the input items and document data
|
||||
const items = context.getInputData();
|
||||
const documentInput = (await context.getInputConnectionData(NodeConnectionType.AiDocument, 0)) as
|
||||
const documentInput = (await context.getInputConnectionData(NodeConnectionTypes.AiDocument, 0)) as
|
||||
| N8nJsonLoader
|
||||
| N8nBinaryLoader
|
||||
| Array<Document<Record<string, unknown>>>;
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
ApplicationError,
|
||||
NodeConnectionType,
|
||||
NodeConnectionTypes,
|
||||
NodeOperationError,
|
||||
updateDisplayOptions,
|
||||
} from 'n8n-workflow';
|
||||
@@ -235,7 +235,7 @@ export async function execute(this: IExecuteFunctions, i: number): Promise<INode
|
||||
nodeVersion >= 1.6 && this.getNodeParameter('memory', i) === 'connector';
|
||||
const memory =
|
||||
useMemoryConnector || nodeVersion < 1.6
|
||||
? ((await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
|
||||
? ((await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as
|
||||
| BufferWindowMemory
|
||||
| undefined)
|
||||
: undefined;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
import type { INodeInputConfiguration, INodeTypeDescription } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import * as assistant from './assistant';
|
||||
import * as audio from './audio';
|
||||
@@ -50,25 +50,25 @@ const configureNodeInputs = (
|
||||
) => {
|
||||
if (resource === 'assistant' && operation === 'message') {
|
||||
const inputs: INodeInputConfiguration[] = [
|
||||
{ type: NodeConnectionType.Main },
|
||||
{ type: NodeConnectionType.AiTool, displayName: 'Tools' },
|
||||
{ type: NodeConnectionTypes.Main },
|
||||
{ type: NodeConnectionTypes.AiTool, displayName: 'Tools' },
|
||||
];
|
||||
if (memory !== 'threadId') {
|
||||
inputs.push({ type: NodeConnectionType.AiMemory, displayName: 'Memory', maxConnections: 1 });
|
||||
inputs.push({ type: NodeConnectionTypes.AiMemory, displayName: 'Memory', maxConnections: 1 });
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
if (resource === 'text' && operation === 'message') {
|
||||
if (hideTools === 'hide') {
|
||||
return [NodeConnectionType.Main];
|
||||
return [NodeConnectionTypes.Main];
|
||||
}
|
||||
return [
|
||||
{ type: NodeConnectionType.Main },
|
||||
{ type: NodeConnectionType.AiTool, displayName: 'Tools' },
|
||||
{ type: NodeConnectionTypes.Main },
|
||||
{ type: NodeConnectionTypes.AiTool, displayName: 'Tools' },
|
||||
];
|
||||
}
|
||||
|
||||
return [NodeConnectionType.Main];
|
||||
return [NodeConnectionTypes.Main];
|
||||
};
|
||||
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-missing-subtitle
|
||||
@@ -98,7 +98,7 @@ export const versionDescription: INodeTypeDescription = {
|
||||
},
|
||||
},
|
||||
inputs: `={{(${configureNodeInputs})($parameter.resource, $parameter.operation, $parameter.hideTools, $parameter.memory ?? undefined)}}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'openAiApi',
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DynamicStructuredToolInput } from '@langchain/core/tools';
|
||||
import { DynamicStructuredTool, DynamicTool } from '@langchain/core/tools';
|
||||
import { StructuredOutputParser } from 'langchain/output_parsers';
|
||||
import type { ISupplyDataFunctions, IDataObject } from 'n8n-workflow';
|
||||
import { NodeConnectionType, jsonParse, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, jsonParse, NodeOperationError } from 'n8n-workflow';
|
||||
import type { ZodTypeAny } from 'zod';
|
||||
import { ZodBoolean, ZodNullable, ZodNumber, ZodObject, ZodOptional } from 'zod';
|
||||
|
||||
@@ -96,8 +96,8 @@ export class N8nTool extends DynamicStructuredTool {
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
const { index } = context.addInputData(NodeConnectionType.AiTool, [[{ json: { query } }]]);
|
||||
void context.addOutputData(NodeConnectionType.AiTool, index, e);
|
||||
const { index } = context.addInputData(NodeConnectionTypes.AiTool, [[{ json: { query } }]]);
|
||||
void context.addOutputData(NodeConnectionTypes.AiTool, index, e);
|
||||
|
||||
return e.toString();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { BaseLLM } from '@langchain/core/language_models/llms';
|
||||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import type { Tool } from '@langchain/core/tools';
|
||||
import type { BaseChatMemory } from 'langchain/memory';
|
||||
import { NodeConnectionType, NodeOperationError, jsonStringify } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError, jsonStringify } from 'n8n-workflow';
|
||||
import type {
|
||||
AiEvent,
|
||||
IDataObject,
|
||||
@@ -190,7 +190,7 @@ export const getConnectedTools = async (
|
||||
escapeCurlyBrackets: boolean = false,
|
||||
) => {
|
||||
const connectedTools =
|
||||
((await ctx.getInputConnectionData(NodeConnectionType.AiTool, 0)) as Tool[]) || [];
|
||||
((await ctx.getInputConnectionData(NodeConnectionTypes.AiTool, 0)) as Tool[]) || [];
|
||||
|
||||
if (!enforceUniqueNames) return connectedTools;
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ import type {
|
||||
INodeExecutionData,
|
||||
ISupplyDataFunctions,
|
||||
ITaskMetadata,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionType, parseErrorMetadata } from 'n8n-workflow';
|
||||
import { NodeOperationError, NodeConnectionTypes, parseErrorMetadata } from 'n8n-workflow';
|
||||
|
||||
import { logAiEvent, isToolsInstance, isBaseChatMemory, isBaseChatMessageHistory } from './helpers';
|
||||
import { N8nBinaryLoader } from './N8nBinaryLoader';
|
||||
@@ -116,7 +117,7 @@ export function logWrapper(
|
||||
if (isBaseChatMemory(originalInstance)) {
|
||||
if (prop === 'loadMemoryVariables' && 'loadMemoryVariables' in target) {
|
||||
return async (values: InputValues): Promise<MemoryVariables> => {
|
||||
connectionType = NodeConnectionType.AiMemory;
|
||||
connectionType = NodeConnectionTypes.AiMemory;
|
||||
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { action: 'loadMemoryVariables', values } }],
|
||||
@@ -139,7 +140,7 @@ export function logWrapper(
|
||||
};
|
||||
} else if (prop === 'saveContext' && 'saveContext' in target) {
|
||||
return async (input: InputValues, output: OutputValues): Promise<MemoryVariables> => {
|
||||
connectionType = NodeConnectionType.AiMemory;
|
||||
connectionType = NodeConnectionTypes.AiMemory;
|
||||
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { action: 'saveContext', input, output } }],
|
||||
@@ -168,7 +169,7 @@ export function logWrapper(
|
||||
if (isBaseChatMessageHistory(originalInstance)) {
|
||||
if (prop === 'getMessages' && 'getMessages' in target) {
|
||||
return async (): Promise<BaseMessage[]> => {
|
||||
connectionType = NodeConnectionType.AiMemory;
|
||||
connectionType = NodeConnectionTypes.AiMemory;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { action: 'getMessages' } }],
|
||||
]);
|
||||
@@ -189,7 +190,7 @@ export function logWrapper(
|
||||
};
|
||||
} else if (prop === 'addMessage' && 'addMessage' in target) {
|
||||
return async (message: BaseMessage): Promise<void> => {
|
||||
connectionType = NodeConnectionType.AiMemory;
|
||||
connectionType = NodeConnectionTypes.AiMemory;
|
||||
const payload = { action: 'addMessage', message };
|
||||
const { index } = executeFunctions.addInputData(connectionType, [[{ json: payload }]]);
|
||||
|
||||
@@ -214,7 +215,7 @@ export function logWrapper(
|
||||
query: string,
|
||||
config?: Callbacks | BaseCallbackConfig,
|
||||
): Promise<Document[]> => {
|
||||
connectionType = NodeConnectionType.AiRetriever;
|
||||
connectionType = NodeConnectionTypes.AiRetriever;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { query, config } }],
|
||||
]);
|
||||
@@ -255,7 +256,7 @@ export function logWrapper(
|
||||
// Docs -> Embeddings
|
||||
if (prop === 'embedDocuments' && 'embedDocuments' in target) {
|
||||
return async (documents: string[]): Promise<number[][]> => {
|
||||
connectionType = NodeConnectionType.AiEmbedding;
|
||||
connectionType = NodeConnectionTypes.AiEmbedding;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { documents } }],
|
||||
]);
|
||||
@@ -276,7 +277,7 @@ export function logWrapper(
|
||||
// Query -> Embeddings
|
||||
if (prop === 'embedQuery' && 'embedQuery' in target) {
|
||||
return async (query: string): Promise<number[]> => {
|
||||
connectionType = NodeConnectionType.AiEmbedding;
|
||||
connectionType = NodeConnectionTypes.AiEmbedding;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { query } }],
|
||||
]);
|
||||
@@ -303,7 +304,7 @@ export function logWrapper(
|
||||
// Process All
|
||||
if (prop === 'processAll' && 'processAll' in target) {
|
||||
return async (items: INodeExecutionData[]): Promise<number[]> => {
|
||||
connectionType = NodeConnectionType.AiDocument;
|
||||
connectionType = NodeConnectionTypes.AiDocument;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [items]);
|
||||
|
||||
const response = (await callMethodAsync.call(target, {
|
||||
@@ -322,7 +323,7 @@ export function logWrapper(
|
||||
// Process Each
|
||||
if (prop === 'processItem' && 'processItem' in target) {
|
||||
return async (item: INodeExecutionData, itemIndex: number): Promise<number[]> => {
|
||||
connectionType = NodeConnectionType.AiDocument;
|
||||
connectionType = NodeConnectionTypes.AiDocument;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [[item]]);
|
||||
|
||||
const response = (await callMethodAsync.call(target, {
|
||||
@@ -346,7 +347,7 @@ export function logWrapper(
|
||||
if (originalInstance instanceof TextSplitter) {
|
||||
if (prop === 'splitText' && 'splitText' in target) {
|
||||
return async (text: string): Promise<string[]> => {
|
||||
connectionType = NodeConnectionType.AiTextSplitter;
|
||||
connectionType = NodeConnectionTypes.AiTextSplitter;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { textSplitter: text } }],
|
||||
]);
|
||||
@@ -370,7 +371,7 @@ export function logWrapper(
|
||||
if (isToolsInstance(originalInstance)) {
|
||||
if (prop === '_call' && '_call' in target) {
|
||||
return async (query: string): Promise<string> => {
|
||||
connectionType = NodeConnectionType.AiTool;
|
||||
connectionType = NodeConnectionTypes.AiTool;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { query } }],
|
||||
]);
|
||||
@@ -399,7 +400,7 @@ export function logWrapper(
|
||||
filter?: BiquadFilterType | undefined,
|
||||
_callbacks?: Callbacks | undefined,
|
||||
): Promise<Document[]> => {
|
||||
connectionType = NodeConnectionType.AiVectorStore;
|
||||
connectionType = NodeConnectionTypes.AiVectorStore;
|
||||
const { index } = executeFunctions.addInputData(connectionType, [
|
||||
[{ json: { query, k, filter } }],
|
||||
]);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user