mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(core): Shovel around more of AI code (no-changelog) (#12218)
This commit is contained in:
parent
a8e7a05856
commit
2ce1644d01
|
@ -9,6 +9,8 @@ import type {
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';
|
||||||
|
|
||||||
import { conversationalAgentProperties } from './agents/ConversationalAgent/description';
|
import { conversationalAgentProperties } from './agents/ConversationalAgent/description';
|
||||||
import { conversationalAgentExecute } from './agents/ConversationalAgent/execute';
|
import { conversationalAgentExecute } from './agents/ConversationalAgent/execute';
|
||||||
import { openAiFunctionsAgentProperties } from './agents/OpenAiFunctionsAgent/description';
|
import { openAiFunctionsAgentProperties } from './agents/OpenAiFunctionsAgent/description';
|
||||||
|
@ -21,7 +23,6 @@ import { sqlAgentAgentProperties } from './agents/SqlAgent/description';
|
||||||
import { sqlAgentAgentExecute } from './agents/SqlAgent/execute';
|
import { sqlAgentAgentExecute } from './agents/SqlAgent/execute';
|
||||||
import { toolsAgentProperties } from './agents/ToolsAgent/description';
|
import { toolsAgentProperties } from './agents/ToolsAgent/description';
|
||||||
import { toolsAgentExecute } from './agents/ToolsAgent/execute';
|
import { toolsAgentExecute } from './agents/ToolsAgent/execute';
|
||||||
import { promptTypeOptions, textFromPreviousNode, textInput } from '../../../utils/descriptions';
|
|
||||||
|
|
||||||
// Function used in the inputs expression to figure out which inputs to
|
// Function used in the inputs expression to figure out which inputs to
|
||||||
// display based on the agent type
|
// display based on the agent type
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { SYSTEM_MESSAGE, HUMAN_MESSAGE } from './prompt';
|
import { SYSTEM_MESSAGE, HUMAN_MESSAGE } from './prompt';
|
||||||
|
|
||||||
export const conversationalAgentProperties: INodeProperties[] = [
|
export const conversationalAgentProperties: INodeProperties[] = [
|
||||||
|
|
|
@ -6,14 +6,11 @@ import { CombiningOutputParser } from 'langchain/output_parsers';
|
||||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import { isChatInstance, getPromptInputByType, getConnectedTools } from '@utils/helpers';
|
||||||
isChatInstance,
|
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||||
getPromptInputByType,
|
import { throwIfToolSchema } from '@utils/schemaParsing';
|
||||||
getConnectedTools,
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
} from '../../../../../utils/helpers';
|
|
||||||
import { getOptionalOutputParsers } from '../../../../../utils/output_parsers/N8nOutputParser';
|
|
||||||
import { throwIfToolSchema } from '../../../../../utils/schemaParsing';
|
|
||||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
|
||||||
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
||||||
|
|
||||||
export async function conversationalAgentExecute(
|
export async function conversationalAgentExecute(
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { SYSTEM_MESSAGE } from './prompt';
|
import { SYSTEM_MESSAGE } from './prompt';
|
||||||
|
|
||||||
export const openAiFunctionsAgentProperties: INodeProperties[] = [
|
export const openAiFunctionsAgentProperties: INodeProperties[] = [
|
||||||
|
|
|
@ -12,9 +12,10 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getConnectedTools, getPromptInputByType } from '../../../../../utils/helpers';
|
import { getConnectedTools, getPromptInputByType } from '@utils/helpers';
|
||||||
import { getOptionalOutputParsers } from '../../../../../utils/output_parsers/N8nOutputParser';
|
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { extractParsedOutput } from '../utils';
|
import { extractParsedOutput } from '../utils';
|
||||||
|
|
||||||
export async function openAiFunctionsAgentExecute(
|
export async function openAiFunctionsAgentExecute(
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { DEFAULT_STEP_EXECUTOR_HUMAN_CHAT_MESSAGE_TEMPLATE } from './prompt';
|
import { DEFAULT_STEP_EXECUTOR_HUMAN_CHAT_MESSAGE_TEMPLATE } from './prompt';
|
||||||
|
|
||||||
export const planAndExecuteAgentProperties: INodeProperties[] = [
|
export const planAndExecuteAgentProperties: INodeProperties[] = [
|
||||||
|
|
|
@ -10,10 +10,11 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getConnectedTools, getPromptInputByType } from '../../../../../utils/helpers';
|
import { getConnectedTools, getPromptInputByType } from '@utils/helpers';
|
||||||
import { getOptionalOutputParsers } from '../../../../../utils/output_parsers/N8nOutputParser';
|
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||||
import { throwIfToolSchema } from '../../../../../utils/schemaParsing';
|
import { throwIfToolSchema } from '@utils/schemaParsing';
|
||||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
||||||
|
|
||||||
export async function planAndExecuteAgentExecute(
|
export async function planAndExecuteAgentExecute(
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { HUMAN_MESSAGE_TEMPLATE, PREFIX, SUFFIX, SUFFIX_CHAT } from './prompt';
|
import { HUMAN_MESSAGE_TEMPLATE, PREFIX, SUFFIX, SUFFIX_CHAT } from './prompt';
|
||||||
|
|
||||||
export const reActAgentAgentProperties: INodeProperties[] = [
|
export const reActAgentAgentProperties: INodeProperties[] = [
|
||||||
|
|
|
@ -11,14 +11,11 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import { getConnectedTools, getPromptInputByType, isChatInstance } from '@utils/helpers';
|
||||||
getConnectedTools,
|
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||||
getPromptInputByType,
|
import { throwIfToolSchema } from '@utils/schemaParsing';
|
||||||
isChatInstance,
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
} from '../../../../../utils/helpers';
|
|
||||||
import { getOptionalOutputParsers } from '../../../../../utils/output_parsers/N8nOutputParser';
|
|
||||||
import { throwIfToolSchema } from '../../../../../utils/schemaParsing';
|
|
||||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
|
||||||
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
||||||
|
|
||||||
export async function reActAgentAgentExecute(
|
export async function reActAgentAgentExecute(
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';
|
||||||
|
|
||||||
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
||||||
import {
|
|
||||||
promptTypeOptions,
|
|
||||||
textFromPreviousNode,
|
|
||||||
textInput,
|
|
||||||
} from '../../../../../utils/descriptions';
|
|
||||||
|
|
||||||
const dataSourceOptions: INodeProperties = {
|
const dataSourceOptions: INodeProperties = {
|
||||||
displayName: 'Data Source',
|
displayName: 'Data Source',
|
||||||
|
|
|
@ -12,12 +12,13 @@ import {
|
||||||
type IDataObject,
|
type IDataObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { getPromptInputByType, serializeChatHistory } from '@utils/helpers';
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { getMysqlDataSource } from './other/handlers/mysql';
|
import { getMysqlDataSource } from './other/handlers/mysql';
|
||||||
import { getPostgresDataSource } from './other/handlers/postgres';
|
import { getPostgresDataSource } from './other/handlers/postgres';
|
||||||
import { getSqliteDataSource } from './other/handlers/sqlite';
|
import { getSqliteDataSource } from './other/handlers/sqlite';
|
||||||
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
import { SQL_PREFIX, SQL_SUFFIX } from './other/prompts';
|
||||||
import { getPromptInputByType, serializeChatHistory } from '../../../../../utils/helpers';
|
|
||||||
import { getTracingConfig } from '../../../../../utils/tracing';
|
|
||||||
|
|
||||||
const parseTablesString = (tablesString: string) =>
|
const parseTablesString = (tablesString: string) =>
|
||||||
tablesString
|
tablesString
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type IExecuteFunctions } from 'n8n-workflow';
|
|
||||||
import { DataSource } from '@n8n/typeorm';
|
import { DataSource } from '@n8n/typeorm';
|
||||||
|
import { type IExecuteFunctions } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function getMysqlDataSource(this: IExecuteFunctions): Promise<DataSource> {
|
export async function getMysqlDataSource(this: IExecuteFunctions): Promise<DataSource> {
|
||||||
const credentials = await this.getCredentials('mySql');
|
const credentials = await this.getCredentials('mySql');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type IExecuteFunctions } from 'n8n-workflow';
|
|
||||||
import { DataSource } from '@n8n/typeorm';
|
import { DataSource } from '@n8n/typeorm';
|
||||||
|
import { type IExecuteFunctions } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function getPostgresDataSource(this: IExecuteFunctions): Promise<DataSource> {
|
export async function getPostgresDataSource(this: IExecuteFunctions): Promise<DataSource> {
|
||||||
const credentials = await this.getCredentials('postgres');
|
const credentials = await this.getCredentials('postgres');
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { DataSource } from '@n8n/typeorm';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||||
import { BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
import { BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
||||||
import * as temp from 'temp';
|
|
||||||
import * as sqlite3 from 'sqlite3';
|
import * as sqlite3 from 'sqlite3';
|
||||||
import { DataSource } from '@n8n/typeorm';
|
import * as temp from 'temp';
|
||||||
|
|
||||||
export async function getSqliteDataSource(
|
export async function getSqliteDataSource(
|
||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { SYSTEM_MESSAGE } from './prompt';
|
import { SYSTEM_MESSAGE } from './prompt';
|
||||||
|
|
||||||
export const toolsAgentProperties: INodeProperties[] = [
|
export const toolsAgentProperties: INodeProperties[] = [
|
||||||
|
|
|
@ -14,16 +14,13 @@ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||||
import type { ZodObject } from 'zod';
|
import type { ZodObject } from 'zod';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { SYSTEM_MESSAGE } from './prompt';
|
import { isChatInstance, getPromptInputByType, getConnectedTools } from '@utils/helpers';
|
||||||
import {
|
|
||||||
isChatInstance,
|
|
||||||
getPromptInputByType,
|
|
||||||
getConnectedTools,
|
|
||||||
} from '../../../../../utils/helpers';
|
|
||||||
import {
|
import {
|
||||||
getOptionalOutputParsers,
|
getOptionalOutputParsers,
|
||||||
type N8nOutputParser,
|
type N8nOutputParser,
|
||||||
} from '../../../../../utils/output_parsers/N8nOutputParser';
|
} from '@utils/output_parsers/N8nOutputParser';
|
||||||
|
|
||||||
|
import { SYSTEM_MESSAGE } from './prompt';
|
||||||
|
|
||||||
function getOutputParserSchema(outputParser: N8nOutputParser): ZodObject<any, any, any, any> {
|
function getOutputParserSchema(outputParser: N8nOutputParser): ZodObject<any, any, any, any> {
|
||||||
const schema =
|
const schema =
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { z } from 'zod';
|
|
||||||
import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
||||||
import type { DynamicStructuredTool, Tool } from 'langchain/tools';
|
import type { DynamicStructuredTool, Tool } from 'langchain/tools';
|
||||||
import { NodeOperationError, type IExecuteFunctions, type INode } from 'n8n-workflow';
|
import { NodeOperationError, type IExecuteFunctions, type INode } from 'n8n-workflow';
|
||||||
|
import type { z } from 'zod';
|
||||||
|
|
||||||
type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,10 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { OpenAI as OpenAIClient } from 'openai';
|
import { OpenAI as OpenAIClient } from 'openai';
|
||||||
|
|
||||||
|
import { getConnectedTools } from '@utils/helpers';
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { formatToOpenAIAssistantTool } from './utils';
|
import { formatToOpenAIAssistantTool } from './utils';
|
||||||
import { getConnectedTools } from '../../../utils/helpers';
|
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
|
||||||
|
|
||||||
export class OpenAiAssistant implements INodeType {
|
export class OpenAiAssistant implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
||||||
import type { OpenAIClient } from '@langchain/openai';
|
|
||||||
import type { StructuredTool } from '@langchain/core/tools';
|
import type { StructuredTool } from '@langchain/core/tools';
|
||||||
|
import type { OpenAIClient } from '@langchain/openai';
|
||||||
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
||||||
|
|
||||||
// Copied from langchain(`langchain/src/tools/convert_to_openai.ts`)
|
// Copied from langchain(`langchain/src/tools/convert_to_openai.ts`)
|
||||||
// since these functions are not exported
|
// since these functions are not exported
|
||||||
|
|
|
@ -27,16 +27,17 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getPromptInputByType, isChatInstance } from '../../../utils/helpers';
|
import { promptTypeOptions, textFromPreviousNode } from '@utils/descriptions';
|
||||||
import type { N8nOutputParser } from '../../../utils/output_parsers/N8nOutputParser';
|
import { getPromptInputByType, isChatInstance } from '@utils/helpers';
|
||||||
import { getOptionalOutputParsers } from '../../../utils/output_parsers/N8nOutputParser';
|
import type { N8nOutputParser } from '@utils/output_parsers/N8nOutputParser';
|
||||||
import { getTemplateNoticeField } from '../../../utils/sharedFields';
|
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getCustomErrorMessage as getCustomOpenAiErrorMessage,
|
getCustomErrorMessage as getCustomOpenAiErrorMessage,
|
||||||
isOpenAiError,
|
isOpenAiError,
|
||||||
} from '../../vendors/OpenAi/helpers/error-handling';
|
} from '../../vendors/OpenAi/helpers/error-handling';
|
||||||
import { promptTypeOptions, textFromPreviousNode } from '../../../utils/descriptions';
|
|
||||||
|
|
||||||
interface MessagesTemplate {
|
interface MessagesTemplate {
|
||||||
type: string;
|
type: string;
|
||||||
|
|
|
@ -16,10 +16,10 @@ import {
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { promptTypeOptions, textFromPreviousNode } from '../../../utils/descriptions';
|
import { promptTypeOptions, textFromPreviousNode } from '@utils/descriptions';
|
||||||
import { getPromptInputByType, isChatInstance } from '../../../utils/helpers';
|
import { getPromptInputByType, isChatInstance } from '@utils/helpers';
|
||||||
import { getTemplateNoticeField } from '../../../utils/sharedFields';
|
import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
const SYSTEM_PROMPT_TEMPLATE = `Use the following pieces of context to answer the users question.
|
const SYSTEM_PROMPT_TEMPLATE = `Use the following pieces of context to answer the users question.
|
||||||
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import type { Document } from '@langchain/core/documents';
|
||||||
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
|
import { PromptTemplate } from '@langchain/core/prompts';
|
||||||
|
import type { SummarizationChainParams } from 'langchain/chains';
|
||||||
|
import { loadSummarizationChain } from 'langchain/chains';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeTypeBaseDescription,
|
type INodeTypeBaseDescription,
|
||||||
|
@ -7,14 +12,10 @@ import {
|
||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { SummarizationChainParams } from 'langchain/chains';
|
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||||
import { loadSummarizationChain } from 'langchain/chains';
|
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||||
import type { Document } from '@langchain/core/documents';
|
|
||||||
import { PromptTemplate } from '@langchain/core/prompts';
|
|
||||||
import { N8nJsonLoader } from '../../../../utils/N8nJsonLoader';
|
|
||||||
import { N8nBinaryLoader } from '../../../../utils/N8nBinaryLoader';
|
|
||||||
import { getTemplateNoticeField } from '../../../../utils/sharedFields';
|
|
||||||
import { REFINE_PROMPT_TEMPLATE, DEFAULT_PROMPT_TEMPLATE } from '../prompt';
|
import { REFINE_PROMPT_TEMPLATE, DEFAULT_PROMPT_TEMPLATE } from '../prompt';
|
||||||
|
|
||||||
export class ChainSummarizationV1 implements INodeType {
|
export class ChainSummarizationV1 implements INodeType {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import type { Document } from '@langchain/core/documents';
|
||||||
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
|
import type { TextSplitter } from '@langchain/textsplitters';
|
||||||
|
import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
|
||||||
|
import { loadSummarizationChain } from 'langchain/chains';
|
||||||
import type {
|
import type {
|
||||||
INodeTypeBaseDescription,
|
INodeTypeBaseDescription,
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -7,18 +11,15 @@ import type {
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||||
|
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
|
import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { loadSummarizationChain } from 'langchain/chains';
|
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
||||||
import type { Document } from '@langchain/core/documents';
|
|
||||||
import type { TextSplitter } from '@langchain/textsplitters';
|
|
||||||
import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
|
|
||||||
import { N8nJsonLoader } from '../../../../utils/N8nJsonLoader';
|
|
||||||
import { N8nBinaryLoader } from '../../../../utils/N8nBinaryLoader';
|
|
||||||
import { getTemplateNoticeField } from '../../../../utils/sharedFields';
|
|
||||||
import { REFINE_PROMPT_TEMPLATE, DEFAULT_PROMPT_TEMPLATE } from '../prompt';
|
|
||||||
import { getChainPromptsArgs } from '../helpers';
|
import { getChainPromptsArgs } from '../helpers';
|
||||||
import { getTracingConfig } from '../../../../utils/tracing';
|
import { REFINE_PROMPT_TEMPLATE, DEFAULT_PROMPT_TEMPLATE } from '../prompt';
|
||||||
|
|
||||||
function getInputs(parameters: IDataObject) {
|
function getInputs(parameters: IDataObject) {
|
||||||
const chunkingMode = parameters?.chunkingMode;
|
const chunkingMode = parameters?.chunkingMode;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { SummarizationChainParams } from 'langchain/chains';
|
|
||||||
import { PromptTemplate } from '@langchain/core/prompts';
|
import { PromptTemplate } from '@langchain/core/prompts';
|
||||||
|
import type { SummarizationChainParams } from 'langchain/chains';
|
||||||
interface ChainTypeOptions {
|
interface ChainTypeOptions {
|
||||||
combineMapPrompt?: string;
|
combineMapPrompt?: string;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
|
|
@ -13,15 +13,12 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { z } from 'zod';
|
import type { z } from 'zod';
|
||||||
|
|
||||||
|
import { inputSchemaField, jsonSchemaExampleField, schemaTypeField } from '@utils/descriptions';
|
||||||
|
import { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
import { makeZodSchemaFromAttributes } from './helpers';
|
import { makeZodSchemaFromAttributes } from './helpers';
|
||||||
import type { AttributeDefinition } from './types';
|
import type { AttributeDefinition } from './types';
|
||||||
import {
|
|
||||||
inputSchemaField,
|
|
||||||
jsonSchemaExampleField,
|
|
||||||
schemaTypeField,
|
|
||||||
} from '../../../utils/descriptions';
|
|
||||||
import { convertJsonSchemaToZod, generateSchema } from '../../../utils/schemaParsing';
|
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
|
||||||
|
|
||||||
const SYSTEM_PROMPT_TEMPLATE = `You are an expert extraction algorithm.
|
const SYSTEM_PROMPT_TEMPLATE = `You are an expert extraction algorithm.
|
||||||
Only extract relevant information from the text.
|
Only extract relevant information from the text.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import type { AttributeDefinition } from './types';
|
import type { AttributeDefinition } from './types';
|
||||||
|
|
||||||
function makeAttributeSchema(attributeDefinition: AttributeDefinition, required: boolean = true) {
|
function makeAttributeSchema(attributeDefinition: AttributeDefinition, required: boolean = true) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow/src';
|
|
||||||
import get from 'lodash/get';
|
|
||||||
|
|
||||||
import { FakeLLM, FakeListChatModel } from '@langchain/core/utils/testing';
|
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
import { InformationExtractor } from '../InformationExtractor.node';
|
import { FakeLLM, FakeListChatModel } from '@langchain/core/utils/testing';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow/src';
|
||||||
|
|
||||||
import { makeZodSchemaFromAttributes } from '../helpers';
|
import { makeZodSchemaFromAttributes } from '../helpers';
|
||||||
|
import { InformationExtractor } from '../InformationExtractor.node';
|
||||||
import type { AttributeDefinition } from '../types';
|
import type { AttributeDefinition } from '../types';
|
||||||
|
|
||||||
const mockPersonAttributes: AttributeDefinition[] = [
|
const mockPersonAttributes: AttributeDefinition[] = [
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
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 type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -6,15 +11,9 @@ import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
|
||||||
|
|
||||||
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 { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
|
||||||
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
const DEFAULT_SYSTEM_PROMPT_TEMPLATE =
|
const DEFAULT_SYSTEM_PROMPT_TEMPLATE =
|
||||||
'You are highly intelligent and accurate sentiment analyzer. Analyze the sentiment of the provided text. Categorize it into one of the following: {categories}. Use the provided formatting instructions. Only output the JSON.';
|
'You are highly intelligent and accurate sentiment analyzer. Analyze the sentiment of the provided text. Categorize it into one of the following: {categories}. Use the provided formatting instructions. Only output the JSON.';
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { getTracingConfig } from '../../../utils/tracing';
|
import { getTracingConfig } from '@utils/tracing';
|
||||||
|
|
||||||
const SYSTEM_PROMPT_TEMPLATE =
|
const SYSTEM_PROMPT_TEMPLATE =
|
||||||
"Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json.";
|
"Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json.";
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { Tool } from '@langchain/core/tools';
|
||||||
|
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, NodeConnectionType } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -12,12 +17,7 @@ import type {
|
||||||
|
|
||||||
// TODO: Add support for execute function. Got already started but got commented out
|
// TODO: Add support for execute function. Got already started but got commented out
|
||||||
|
|
||||||
import { getSandboxContext } from 'n8n-nodes-base/dist/nodes/Code/Sandbox';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { JavaScriptSandbox } from 'n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox';
|
|
||||||
import { standardizeOutput } from 'n8n-nodes-base/dist/nodes/Code/utils';
|
|
||||||
import type { Tool } from '@langchain/core/tools';
|
|
||||||
import { makeResolverFromLegacyOptions } from '@n8n/vm2';
|
|
||||||
import { logWrapper } from '../../utils/logWrapper';
|
|
||||||
|
|
||||||
const { NODE_FUNCTION_ALLOW_BUILTIN: builtIn, NODE_FUNCTION_ALLOW_EXTERNAL: external } =
|
const { NODE_FUNCTION_ALLOW_BUILTIN: builtIn, NODE_FUNCTION_ALLOW_EXTERNAL: external } =
|
||||||
process.env;
|
process.env;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { TextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,11 +8,9 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { TextSplitter } from '@langchain/textsplitters';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getConnectionHintNoticeField, metadataFilterField } from '@utils/sharedFields';
|
||||||
import { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
|
||||||
import { getConnectionHintNoticeField, metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
// Dependencies needed underneath the hood for the loaders. We add them
|
// Dependencies needed underneath the hood for the loaders. We add them
|
||||||
// here only to track where what dependency is sued
|
// here only to track where what dependency is sued
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { TextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,9 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { TextSplitter } from '@langchain/textsplitters';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||||
import { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
// Dependencies needed underneath the hood for the loaders. We add them
|
// Dependencies needed underneath the hood for the loaders. We add them
|
||||||
// here only to track where what dependency is sued
|
// here only to track where what dependency is sued
|
||||||
|
@ -18,7 +18,7 @@ import { metadataFilterField } from '../../../utils/sharedFields';
|
||||||
import 'mammoth'; // for docx
|
import 'mammoth'; // for docx
|
||||||
import 'epub2'; // for epub
|
import 'epub2'; // for epub
|
||||||
import 'pdf-parse'; // for pdf
|
import 'pdf-parse'; // for pdf
|
||||||
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
|
|
||||||
export class DocumentDefaultDataLoader implements INodeType {
|
export class DocumentDefaultDataLoader implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { GithubRepoLoader } from '@langchain/community/document_loaders/web/github';
|
||||||
|
import type { CharacterTextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,10 +8,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { GithubRepoLoader } from '@langchain/community/document_loaders/web/github';
|
|
||||||
import type { CharacterTextSplitter } from '@langchain/textsplitters';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class DocumentGithubLoader implements INodeType {
|
export class DocumentGithubLoader implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { TextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,9 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { TextSplitter } from '@langchain/textsplitters';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
import { getConnectionHintNoticeField, metadataFilterField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField, metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class DocumentJsonInputLoader implements INodeType {
|
export class DocumentJsonInputLoader implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class EmbeddingsAwsBedrock implements INodeType {
|
export class EmbeddingsAwsBedrock implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { OpenAIEmbeddings } from '@langchain/openai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,9 +8,8 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { OpenAIEmbeddings } from '@langchain/openai';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class EmbeddingsAzureOpenAi implements INodeType {
|
export class EmbeddingsAzureOpenAi implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { CohereEmbeddings } from '@langchain/cohere';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { CohereEmbeddings } from '@langchain/cohere';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class EmbeddingsCohere implements INodeType {
|
export class EmbeddingsCohere implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { GoogleGenerativeAIEmbeddings } from '@langchain/google-genai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,10 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { GoogleGenerativeAIEmbeddings } from '@langchain/google-genai';
|
|
||||||
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class EmbeddingsGoogleGemini implements INodeType {
|
export class EmbeddingsGoogleGemini implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { HuggingFaceInferenceEmbeddings } from '@langchain/community/embeddings/hf';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { HuggingFaceInferenceEmbeddings } from '@langchain/community/embeddings/hf';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class EmbeddingsHuggingFaceInference implements INodeType {
|
export class EmbeddingsHuggingFaceInference implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { MistralAIEmbeddingsParams } from '@langchain/mistralai';
|
||||||
|
import { MistralAIEmbeddings } from '@langchain/mistralai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,10 +8,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { MistralAIEmbeddingsParams } from '@langchain/mistralai';
|
|
||||||
import { MistralAIEmbeddings } from '@langchain/mistralai';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class EmbeddingsMistralCloud implements INodeType {
|
export class EmbeddingsMistralCloud implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { OllamaEmbeddings } from '@langchain/ollama';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,10 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { OllamaEmbeddings } from '@langchain/ollama';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { ollamaDescription, ollamaModel } from '../../llms/LMOllama/description';
|
import { ollamaDescription, ollamaModel } from '../../llms/LMOllama/description';
|
||||||
|
|
||||||
export class EmbeddingsOllama implements INodeType {
|
export class EmbeddingsOllama implements INodeType {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { OpenAIEmbeddings } from '@langchain/openai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,11 +8,10 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type INodeProperties,
|
type INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { ClientOptions } from 'openai';
|
import type { ClientOptions } from 'openai';
|
||||||
import { OpenAIEmbeddings } from '@langchain/openai';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
const modelParameter: INodeProperties = {
|
const modelParameter: INodeProperties = {
|
||||||
displayName: 'Model',
|
displayName: 'Model',
|
||||||
|
|
|
@ -12,9 +12,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
const modelField: INodeProperties = {
|
const modelField: INodeProperties = {
|
||||||
displayName: 'Model',
|
displayName: 'Model',
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
|
||||||
|
import type { ChatOllamaInput } from '@langchain/ollama';
|
||||||
|
import { ChatOllama } from '@langchain/ollama';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,12 +10,11 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { ChatOllamaInput } from '@langchain/ollama';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { ChatOllama } from '@langchain/ollama';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { ollamaModel, ollamaOptions, ollamaDescription } from '../LMOllama/description';
|
import { ollamaModel, ollamaOptions, ollamaDescription } from '../LMOllama/description';
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatOllama implements INodeType {
|
export class LmChatOllama implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { openAiFailedAttemptHandler } from '../../vendors/OpenAi/helpers/error-handling';
|
import { openAiFailedAttemptHandler } from '../../vendors/OpenAi/helpers/error-handling';
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { Cohere } from '@langchain/cohere';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { Cohere } from '@langchain/cohere';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmCohere implements INodeType {
|
export class LmCohere implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
|
||||||
|
import { Ollama } from '@langchain/community/llms/ollama';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,11 +9,11 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { Ollama } from '@langchain/community/llms/ollama';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { ollamaDescription, ollamaModel, ollamaOptions } from './description';
|
import { ollamaDescription, ollamaModel, ollamaOptions } from './description';
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmOllama implements INodeType {
|
export class LmOllama implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { OpenAI, type ClientOptions } from '@langchain/openai';
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
|
@ -8,9 +9,8 @@ import type {
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { OpenAI, type ClientOptions } from '@langchain/openai';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
type LmOpenAiOptions = {
|
type LmOpenAiOptions = {
|
||||||
baseURL?: string;
|
baseURL?: string;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { HuggingFaceInference } from '@langchain/community/llms/hf';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { HuggingFaceInference } from '@langchain/community/llms/hf';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmOpenHuggingFaceInference implements INodeType {
|
export class LmOpenHuggingFaceInference implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -8,9 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatAwsBedrock implements INodeType {
|
export class LmChatAwsBedrock implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { ChatOpenAI } from '@langchain/openai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ChatOpenAI } from '@langchain/openai';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatAzureOpenAi implements INodeType {
|
export class LmChatAzureOpenAi implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { SafetySetting } from '@google/generative-ai';
|
||||||
|
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,12 +8,12 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
|
||||||
import type { SafetySetting } from '@google/generative-ai';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { additionalOptions } from '../gemini-common/additional-options';
|
import { additionalOptions } from '../gemini-common/additional-options';
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatGoogleGemini implements INodeType {
|
export class LmChatGoogleGemini implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { SafetySetting } from '@google/generative-ai';
|
||||||
|
import { ProjectsClient } from '@google-cloud/resource-manager';
|
||||||
|
import { ChatVertexAI } from '@langchain/google-vertexai';
|
||||||
|
import { formatPrivateKey } from 'n8n-nodes-base/dist/utils/utilities';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -9,15 +13,13 @@ import {
|
||||||
type JsonObject,
|
type JsonObject,
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { ChatVertexAI } from '@langchain/google-vertexai';
|
|
||||||
import type { SafetySetting } from '@google/generative-ai';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { ProjectsClient } from '@google-cloud/resource-manager';
|
|
||||||
import { formatPrivateKey } from 'n8n-nodes-base/dist/utils/utilities';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { additionalOptions } from '../gemini-common/additional-options';
|
|
||||||
import { makeErrorFromStatus } from './error-handling';
|
import { makeErrorFromStatus } from './error-handling';
|
||||||
|
import { additionalOptions } from '../gemini-common/additional-options';
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatGoogleVertex implements INodeType {
|
export class LmChatGoogleVertex implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { ChatGroq } from '@langchain/groq';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,10 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ChatGroq } from '@langchain/groq';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatGroq implements INodeType {
|
export class LmChatGroq implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
|
||||||
|
import type { ChatMistralAIInput } from '@langchain/mistralai';
|
||||||
|
import { ChatMistralAI } from '@langchain/mistralai';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,11 +10,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { ChatMistralAIInput } from '@langchain/mistralai';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { ChatMistralAI } from '@langchain/mistralai';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
|
||||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||||
|
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||||
|
|
||||||
export class LmChatMistralCloud implements INodeType {
|
export class LmChatMistralCloud implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -9,11 +9,11 @@ import type {
|
||||||
import type { BaseMessage } from '@langchain/core/messages';
|
import type { BaseMessage } from '@langchain/core/messages';
|
||||||
import type { LLMResult } from '@langchain/core/outputs';
|
import type { LLMResult } from '@langchain/core/outputs';
|
||||||
import { encodingForModel } from '@langchain/core/utils/tiktoken';
|
import { encodingForModel } from '@langchain/core/utils/tiktoken';
|
||||||
import type { IDataObject, ISupplyDataFunctions, JsonObject } from 'n8n-workflow';
|
|
||||||
import { pick } from 'lodash';
|
import { pick } from 'lodash';
|
||||||
|
import type { IDataObject, ISupplyDataFunctions, JsonObject } from 'n8n-workflow';
|
||||||
import { NodeConnectionType, NodeError, NodeOperationError } from 'n8n-workflow';
|
import { NodeConnectionType, NodeError, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { logAiEvent } from '../../utils/helpers';
|
import { logAiEvent } from '@utils/helpers';
|
||||||
|
|
||||||
type TokensUsageParser = (llmOutput: LLMResult['llmOutput']) => {
|
type TokensUsageParser = (llmOutput: LLMResult['llmOutput']) => {
|
||||||
completionTokens: number;
|
completionTokens: number;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { HarmBlockThreshold, HarmCategory } from '@google/generative-ai';
|
import type { HarmBlockThreshold, HarmCategory } from '@google/generative-ai';
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { harmCategories, harmThresholds } from './safety-options';
|
import { harmCategories, harmThresholds } from './safety-options';
|
||||||
|
|
||||||
export const additionalOptions: INodeProperties = {
|
export const additionalOptions: INodeProperties = {
|
||||||
|
|
|
@ -9,9 +9,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sessionIdOption,
|
sessionIdOption,
|
||||||
sessionKeyProperty,
|
sessionKeyProperty,
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
||||||
|
import type { BaseMessage } from '@langchain/core/messages';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type IDataObject,
|
type IDataObject,
|
||||||
|
@ -7,8 +9,6 @@ import {
|
||||||
type INodeType,
|
type INodeType,
|
||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
|
||||||
import type { BaseMessage } from '@langchain/core/messages';
|
|
||||||
|
|
||||||
function simplifyMessages(messages: BaseMessage[]) {
|
function simplifyMessages(messages: BaseMessage[]) {
|
||||||
const chunkedMessages = [];
|
const chunkedMessages = [];
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* 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 { NodeConnectionType } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -7,8 +9,6 @@ import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';
|
|
||||||
import { AIMessage, SystemMessage, HumanMessage, type BaseMessage } from '@langchain/core/messages';
|
|
||||||
|
|
||||||
type MessageRole = 'ai' | 'system' | 'user';
|
type MessageRole = 'ai' | 'system' | 'user';
|
||||||
interface MessageRecord {
|
interface MessageRecord {
|
||||||
|
|
|
@ -8,9 +8,10 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { expressionSessionKeyProperty, sessionIdOption, sessionKeyProperty } from '../descriptions';
|
import { expressionSessionKeyProperty, sessionIdOption, sessionKeyProperty } from '../descriptions';
|
||||||
|
|
||||||
export class MemoryMotorhead implements INodeType {
|
export class MemoryMotorhead implements INodeType {
|
||||||
|
|
|
@ -13,9 +13,10 @@ import type {
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
import type pg from 'pg';
|
import type pg from 'pg';
|
||||||
|
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sessionIdOption,
|
sessionIdOption,
|
||||||
sessionKeyProperty,
|
sessionKeyProperty,
|
||||||
|
|
|
@ -13,9 +13,10 @@ import {
|
||||||
import type { RedisClientOptions } from 'redis';
|
import type { RedisClientOptions } from 'redis';
|
||||||
import { createClient } from 'redis';
|
import { createClient } from 'redis';
|
||||||
|
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sessionIdOption,
|
sessionIdOption,
|
||||||
sessionKeyProperty,
|
sessionKeyProperty,
|
||||||
|
|
|
@ -10,9 +10,10 @@ import type {
|
||||||
SupplyData,
|
SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sessionIdOption,
|
sessionIdOption,
|
||||||
sessionKeyProperty,
|
sessionKeyProperty,
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { BaseChatMemory } from '@langchain/community/dist/memory/chat_memory';
|
||||||
|
import { ZepMemory } from '@langchain/community/memory/zep';
|
||||||
|
import { ZepCloudMemory } from '@langchain/community/memory/zep_cloud';
|
||||||
|
import type { InputValues, MemoryVariables } from '@langchain/core/memory';
|
||||||
|
import type { BaseMessage } from '@langchain/core/messages';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
|
@ -7,16 +12,12 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
NodeOperationError,
|
NodeOperationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { ZepMemory } from '@langchain/community/memory/zep';
|
|
||||||
import { ZepCloudMemory } from '@langchain/community/memory/zep_cloud';
|
|
||||||
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getSessionId } from '@utils/helpers';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { expressionSessionKeyProperty, sessionIdOption, sessionKeyProperty } from '../descriptions';
|
import { expressionSessionKeyProperty, sessionIdOption, sessionKeyProperty } from '../descriptions';
|
||||||
import { getSessionId } from '../../../utils/helpers';
|
|
||||||
import type { BaseChatMemory } from '@langchain/community/dist/memory/chat_memory';
|
|
||||||
import type { InputValues, MemoryVariables } from '@langchain/core/memory';
|
|
||||||
import type { BaseMessage } from '@langchain/core/messages';
|
|
||||||
|
|
||||||
// Extend ZepCloudMemory to trim white space in messages.
|
// Extend ZepCloudMemory to trim white space in messages.
|
||||||
class WhiteSpaceTrimmedZepCloudMemory extends ZepCloudMemory {
|
class WhiteSpaceTrimmedZepCloudMemory extends ZepCloudMemory {
|
||||||
|
|
|
@ -8,12 +8,13 @@ import type {
|
||||||
SupplyData,
|
SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { NAIVE_FIX_PROMPT } from './prompt';
|
|
||||||
import {
|
import {
|
||||||
N8nOutputFixingParser,
|
N8nOutputFixingParser,
|
||||||
type N8nStructuredOutputParser,
|
type N8nStructuredOutputParser,
|
||||||
} from '../../../utils/output_parsers/N8nOutputParser';
|
} from '@utils/output_parsers/N8nOutputParser';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
|
import { NAIVE_FIX_PROMPT } from './prompt';
|
||||||
|
|
||||||
export class OutputParserAutofixing implements INodeType {
|
export class OutputParserAutofixing implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -11,7 +11,8 @@ import { ApplicationError, NodeConnectionType, NodeOperationError } from 'n8n-wo
|
||||||
import type {
|
import type {
|
||||||
N8nOutputFixingParser,
|
N8nOutputFixingParser,
|
||||||
N8nStructuredOutputParser,
|
N8nStructuredOutputParser,
|
||||||
} from '../../../../utils/output_parsers/N8nOutputParser';
|
} from '@utils/output_parsers/N8nOutputParser';
|
||||||
|
|
||||||
import { OutputParserAutofixing } from '../OutputParserAutofixing.node';
|
import { OutputParserAutofixing } from '../OutputParserAutofixing.node';
|
||||||
import { NAIVE_FIX_PROMPT } from '../prompt';
|
import { NAIVE_FIX_PROMPT } from '../prompt';
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { N8nItemListOutputParser } from '../../../utils/output_parsers/N8nItemListOutputParser';
|
import { N8nItemListOutputParser } from '@utils/output_parsers/N8nItemListOutputParser';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class OutputParserItemList implements INodeType {
|
export class OutputParserItemList implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -6,7 +6,8 @@ import {
|
||||||
type IWorkflowDataProxyData,
|
type IWorkflowDataProxyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { N8nItemListOutputParser } from '../../../../utils/output_parsers/N8nItemListOutputParser';
|
import { N8nItemListOutputParser } from '@utils/output_parsers/N8nItemListOutputParser';
|
||||||
|
|
||||||
import { OutputParserItemList } from '../OutputParserItemList.node';
|
import { OutputParserItemList } from '../OutputParserItemList.node';
|
||||||
|
|
||||||
describe('OutputParserItemList', () => {
|
describe('OutputParserItemList', () => {
|
||||||
|
|
|
@ -10,14 +10,10 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { z } from 'zod';
|
import type { z } from 'zod';
|
||||||
|
|
||||||
import {
|
import { inputSchemaField, jsonSchemaExampleField, schemaTypeField } from '@utils/descriptions';
|
||||||
inputSchemaField,
|
import { N8nStructuredOutputParser } from '@utils/output_parsers/N8nOutputParser';
|
||||||
jsonSchemaExampleField,
|
import { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';
|
||||||
schemaTypeField,
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
} from '../../../utils/descriptions';
|
|
||||||
import { N8nStructuredOutputParser } from '../../../utils/output_parsers/N8nOutputParser';
|
|
||||||
import { convertJsonSchemaToZod, generateSchema } from '../../../utils/schemaParsing';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class OutputParserStructured implements INodeType {
|
export class OutputParserStructured implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -7,7 +7,8 @@ import {
|
||||||
type IWorkflowDataProxyData,
|
type IWorkflowDataProxyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import type { N8nStructuredOutputParser } from '../../../../utils/output_parsers/N8nStructuredOutputParser';
|
import type { N8nStructuredOutputParser } from '@utils/output_parsers/N8nStructuredOutputParser';
|
||||||
|
|
||||||
import { OutputParserStructured } from '../OutputParserStructured.node';
|
import { OutputParserStructured } from '../OutputParserStructured.node';
|
||||||
|
|
||||||
describe('OutputParserStructured', () => {
|
describe('OutputParserStructured', () => {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
|
||||||
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
|
import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||||
|
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression';
|
||||||
|
import { LLMChainExtractor } from 'langchain/retrievers/document_compressors/chain_extract';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,12 +12,7 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { LLMChainExtractor } from 'langchain/retrievers/document_compressors/chain_extract';
|
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
||||||
import type { BaseRetriever } from '@langchain/core/retrievers';
|
|
||||||
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
|
|
||||||
export class RetrieverContextualCompression implements INodeType {
|
export class RetrieverContextualCompression implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
|
||||||
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
|
import type { BaseRetriever } from '@langchain/core/retrievers';
|
||||||
|
import { MultiQueryRetriever } from 'langchain/retrievers/multi_query';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -7,11 +11,7 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { MultiQueryRetriever } from 'langchain/retrievers/multi_query';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
||||||
import type { BaseRetriever } from '@langchain/core/retrievers';
|
|
||||||
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
|
|
||||||
export class RetrieverMultiQuery implements INodeType {
|
export class RetrieverMultiQuery implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,8 +7,8 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
|
||||||
export class RetrieverVectorStore implements INodeType {
|
export class RetrieverVectorStore implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
||||||
|
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 { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -13,13 +18,7 @@ import type {
|
||||||
ExecuteWorkflowData,
|
ExecuteWorkflowData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { BaseRetriever, type BaseRetrieverInput } from '@langchain/core/retrievers';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { Document } from '@langchain/core/documents';
|
|
||||||
|
|
||||||
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 type { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
|
|
||||||
function objectToString(obj: Record<string, string> | IDataObject, level = 0) {
|
function objectToString(obj: Record<string, string> | IDataObject, level = 0) {
|
||||||
let result = '';
|
let result = '';
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { CharacterTextSplitterParams } from '@langchain/textsplitters';
|
||||||
|
import { CharacterTextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,10 +8,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { CharacterTextSplitterParams } from '@langchain/textsplitters';
|
|
||||||
import { CharacterTextSplitter } from '@langchain/textsplitters';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class TextSplitterCharacterTextSplitter implements INodeType {
|
export class TextSplitterCharacterTextSplitter implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type {
|
||||||
|
RecursiveCharacterTextSplitterParams,
|
||||||
|
SupportedTextSplitterLanguage,
|
||||||
|
} from '@langchain/textsplitters';
|
||||||
|
import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,13 +11,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type {
|
|
||||||
RecursiveCharacterTextSplitterParams,
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
SupportedTextSplitterLanguage,
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
} from '@langchain/textsplitters';
|
|
||||||
import { RecursiveCharacterTextSplitter } from '@langchain/textsplitters';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
const supportedLanguages: SupportedTextSplitterLanguage[] = [
|
const supportedLanguages: SupportedTextSplitterLanguage[] = [
|
||||||
'cpp',
|
'cpp',
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { TokenTextSplitter } from '@langchain/textsplitters';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { TokenTextSplitter } from '@langchain/textsplitters';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class TextSplitterTokenSplitter implements INodeType {
|
export class TextSplitterTokenSplitter implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { Calculator } from '@langchain/community/tools/calculator';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { Calculator } from '@langchain/community/tools/calculator';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class ToolCalculator implements INodeType {
|
export class ToolCalculator implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -15,14 +15,11 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
import { jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { inputSchemaField, jsonSchemaExampleField, schemaTypeField } from '@utils/descriptions';
|
||||||
|
import { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';
|
||||||
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import type { DynamicZodObject } from '../../../types/zod.types';
|
import type { DynamicZodObject } from '../../../types/zod.types';
|
||||||
import {
|
|
||||||
inputSchemaField,
|
|
||||||
jsonSchemaExampleField,
|
|
||||||
schemaTypeField,
|
|
||||||
} from '../../../utils/descriptions';
|
|
||||||
import { convertJsonSchemaToZod, generateSchema } from '../../../utils/schemaParsing';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class ToolCode implements INodeType {
|
export class ToolCode implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { DynamicTool } from '@langchain/core/tools';
|
||||||
import type {
|
import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
|
@ -9,19 +10,8 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType, NodeOperationError, tryToParseAlphanumericString } from 'n8n-workflow';
|
import { NodeConnectionType, NodeOperationError, tryToParseAlphanumericString } from 'n8n-workflow';
|
||||||
|
|
||||||
import { DynamicTool } from '@langchain/core/tools';
|
import { N8nTool } from '@utils/N8nTool';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { N8nTool } from '../../../utils/N8nTool';
|
|
||||||
import {
|
|
||||||
configureHttpRequestFunction,
|
|
||||||
configureResponseOptimizer,
|
|
||||||
extractParametersFromText,
|
|
||||||
prepareToolDescription,
|
|
||||||
configureToolFunction,
|
|
||||||
updateParametersAndOptions,
|
|
||||||
makeToolInputSchema,
|
|
||||||
} from './utils';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
authenticationProperties,
|
authenticationProperties,
|
||||||
|
@ -31,8 +21,16 @@ import {
|
||||||
placeholderDefinitionsCollection,
|
placeholderDefinitionsCollection,
|
||||||
specifyBySelector,
|
specifyBySelector,
|
||||||
} from './descriptions';
|
} from './descriptions';
|
||||||
|
|
||||||
import type { PlaceholderDefinition, ToolParameter } from './interfaces';
|
import type { PlaceholderDefinition, ToolParameter } from './interfaces';
|
||||||
|
import {
|
||||||
|
configureHttpRequestFunction,
|
||||||
|
configureResponseOptimizer,
|
||||||
|
extractParametersFromText,
|
||||||
|
prepareToolDescription,
|
||||||
|
configureToolFunction,
|
||||||
|
updateParametersAndOptions,
|
||||||
|
makeToolInputSchema,
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
export class ToolHttpRequest implements INodeType {
|
export class ToolHttpRequest implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { mock } from 'jest-mock-extended';
|
||||||
import type { IExecuteFunctions, INode } from 'n8n-workflow';
|
import type { IExecuteFunctions, INode } from 'n8n-workflow';
|
||||||
import { jsonParse } from 'n8n-workflow';
|
import { jsonParse } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { N8nTool } from '../../../../utils/N8nTool';
|
import type { N8nTool } from '@utils/N8nTool';
|
||||||
|
|
||||||
import { ToolHttpRequest } from '../ToolHttpRequest.node';
|
import { ToolHttpRequest } from '../ToolHttpRequest.node';
|
||||||
|
|
||||||
describe('ToolHttpRequest', () => {
|
describe('ToolHttpRequest', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { SerpAPI } from '@langchain/community/tools/serpapi';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { SerpAPI } from '@langchain/community/tools/serpapi';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class ToolSerpApi implements INodeType {
|
export class ToolSerpApi implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
||||||
|
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||||
|
import { VectorDBQAChain } from 'langchain/chains';
|
||||||
|
import { VectorStoreQATool } from 'langchain/tools';
|
||||||
import type {
|
import type {
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
|
@ -6,12 +10,8 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { VectorStoreQATool } from 'langchain/tools';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
||||||
import { VectorDBQAChain } from 'langchain/chains';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
|
|
||||||
export class ToolVectorStore implements INodeType {
|
export class ToolVectorStore implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { WikipediaQueryRun } from '@langchain/community/tools/wikipedia_query_run';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { WikipediaQueryRun } from '@langchain/community/tools/wikipedia_query_run';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class ToolWikipedia implements INodeType {
|
export class ToolWikipedia implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import { WolframAlphaTool } from '@langchain/community/tools/wolframalpha';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,9 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { WolframAlphaTool } from '@langchain/community/tools/wolframalpha';
|
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
export class ToolWolframAlpha implements INodeType {
|
export class ToolWolframAlpha implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -21,14 +21,11 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType, NodeOperationError, jsonParse } from 'n8n-workflow';
|
import { NodeConnectionType, NodeOperationError, jsonParse } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { jsonSchemaExampleField, schemaTypeField, inputSchemaField } from '@utils/descriptions';
|
||||||
|
import { convertJsonSchemaToZod, generateSchema } from '@utils/schemaParsing';
|
||||||
|
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import type { DynamicZodObject } from '../../../types/zod.types';
|
import type { DynamicZodObject } from '../../../types/zod.types';
|
||||||
import {
|
|
||||||
jsonSchemaExampleField,
|
|
||||||
schemaTypeField,
|
|
||||||
inputSchemaField,
|
|
||||||
} from '../../../utils/descriptions';
|
|
||||||
import { convertJsonSchemaToZod, generateSchema } from '../../../utils/schemaParsing';
|
|
||||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
export class ToolWorkflow implements INodeType {
|
export class ToolWorkflow implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { ICredentialDataDecryptedObject, IWebhookFunctions } from 'n8n-workflow';
|
|
||||||
import basicAuth from 'basic-auth';
|
import basicAuth from 'basic-auth';
|
||||||
|
import type { ICredentialDataDecryptedObject, IWebhookFunctions } from 'n8n-workflow';
|
||||||
|
|
||||||
import { ChatTriggerAuthorizationError } from './error';
|
import { ChatTriggerAuthorizationError } from './error';
|
||||||
import type { AuthenticationChatOption } from './types';
|
import type { AuthenticationChatOption } from './types';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
|
import type { Document } from 'langchain/document';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeExecutionData,
|
type INodeExecutionData,
|
||||||
|
@ -6,11 +8,11 @@ import {
|
||||||
type INodeType,
|
type INodeType,
|
||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Document } from 'langchain/document';
|
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
|
||||||
import { processDocuments } from '../shared/processDocuments';
|
|
||||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||||
|
import { processDocuments } from '../shared/processDocuments';
|
||||||
|
|
||||||
// This node is deprecated. Use VectorStoreInMemory instead.
|
// This node is deprecated. Use VectorStoreInMemory instead.
|
||||||
export class VectorStoreInMemoryInsert implements INodeType {
|
export class VectorStoreInMemoryInsert implements INodeType {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -6,9 +7,10 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
|
||||||
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
|
|
||||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
|
|
||||||
// This node is deprecated. Use VectorStoreInMemory instead.
|
// This node is deprecated. Use VectorStoreInMemory instead.
|
||||||
export class VectorStoreInMemoryLoad implements INodeType {
|
export class VectorStoreInMemoryLoad implements INodeType {
|
||||||
|
|
|
@ -9,7 +9,8 @@ import { configurePostgres } from 'n8n-nodes-base/dist/nodes/Postgres/v2/transpo
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import type pg from 'pg';
|
import type pg from 'pg';
|
||||||
|
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
|
|
||||||
type CollectionOptions = {
|
type CollectionOptions = {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
|
||||||
import type { PineconeStoreParams } from '@langchain/pinecone';
|
import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||||
import { PineconeStore } from '@langchain/pinecone';
|
import { PineconeStore } from '@langchain/pinecone';
|
||||||
import { Pinecone } from '@pinecone-database/pinecone';
|
import { Pinecone } from '@pinecone-database/pinecone';
|
||||||
|
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||||
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import type { Document } from '@langchain/core/documents';
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
|
import { PineconeStore } from '@langchain/pinecone';
|
||||||
|
import { Pinecone } from '@pinecone-database/pinecone';
|
||||||
import {
|
import {
|
||||||
type IExecuteFunctions,
|
type IExecuteFunctions,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -5,15 +9,12 @@ import {
|
||||||
type INodeExecutionData,
|
type INodeExecutionData,
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
|
||||||
import type { Document } from '@langchain/core/documents';
|
|
||||||
|
|
||||||
import { PineconeStore } from '@langchain/pinecone';
|
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
import { Pinecone } from '@pinecone-database/pinecone';
|
|
||||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
|
||||||
import { processDocuments } from '../shared/processDocuments';
|
|
||||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||||
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
||||||
|
import { processDocuments } from '../shared/processDocuments';
|
||||||
|
|
||||||
// This node is deprecated. Use VectorStorePinecone instead.
|
// This node is deprecated. Use VectorStorePinecone instead.
|
||||||
export class VectorStorePineconeInsert implements INodeType {
|
export class VectorStorePineconeInsert implements INodeType {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
|
import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||||
|
import { PineconeStore } from '@langchain/pinecone';
|
||||||
|
import { Pinecone } from '@pinecone-database/pinecone';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -5,14 +9,11 @@ import {
|
||||||
type ISupplyDataFunctions,
|
type ISupplyDataFunctions,
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { PineconeStoreParams } from '@langchain/pinecone';
|
|
||||||
import { PineconeStore } from '@langchain/pinecone';
|
|
||||||
import { Pinecone } from '@pinecone-database/pinecone';
|
|
||||||
|
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
|
||||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||||
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
import type { Callbacks } from '@langchain/core/callbacks/manager';
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
import type { QdrantLibArgs } from '@langchain/qdrant';
|
import type { QdrantLibArgs } from '@langchain/qdrant';
|
||||||
import { QdrantVectorStore } from '@langchain/qdrant';
|
import { QdrantVectorStore } from '@langchain/qdrant';
|
||||||
import type { Schemas as QdrantSchemas } from '@qdrant/js-client-rest';
|
import type { Schemas as QdrantSchemas } from '@qdrant/js-client-rest';
|
||||||
|
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
import { qdrantCollectionRLC } from '../shared/descriptions';
|
import { qdrantCollectionRLC } from '../shared/descriptions';
|
||||||
import { qdrantCollectionsSearch } from '../shared/methods/listSearch';
|
import { qdrantCollectionsSearch } from '../shared/methods/listSearch';
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
|
||||||
import type { Callbacks } from '@langchain/core/callbacks/manager';
|
|
||||||
|
|
||||||
class ExtendedQdrantVectorStore extends QdrantVectorStore {
|
class ExtendedQdrantVectorStore extends QdrantVectorStore {
|
||||||
private static defaultFilter: IDataObject = {};
|
private static defaultFilter: IDataObject = {};
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
|
||||||
import { createClient } from '@supabase/supabase-js';
|
|
||||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||||
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||||
|
import type { Document } from '@langchain/core/documents';
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
import {
|
import {
|
||||||
type IExecuteFunctions,
|
type IExecuteFunctions,
|
||||||
type INodeType,
|
type INodeType,
|
||||||
|
@ -5,15 +9,12 @@ import {
|
||||||
type INodeExecutionData,
|
type INodeExecutionData,
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
|
||||||
import type { Document } from '@langchain/core/documents';
|
|
||||||
import { createClient } from '@supabase/supabase-js';
|
|
||||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
|
||||||
|
|
||||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||||
import { processDocuments } from '../shared/processDocuments';
|
|
||||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||||
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
||||||
|
import { processDocuments } from '../shared/processDocuments';
|
||||||
|
|
||||||
// This node is deprecated. Use VectorStoreSupabase instead.
|
// This node is deprecated. Use VectorStoreSupabase instead.
|
||||||
export class VectorStoreSupabaseInsert implements INodeType {
|
export class VectorStoreSupabaseInsert implements INodeType {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
import type { SupabaseLibArgs } from '@langchain/community/vectorstores/supabase';
|
||||||
|
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||||
|
import type { Embeddings } from '@langchain/core/embeddings';
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
import {
|
import {
|
||||||
type INodeType,
|
type INodeType,
|
||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
|
@ -5,13 +9,11 @@ import {
|
||||||
type SupplyData,
|
type SupplyData,
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Embeddings } from '@langchain/core/embeddings';
|
|
||||||
import { createClient } from '@supabase/supabase-js';
|
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||||
import type { SupabaseLibArgs } from '@langchain/community/vectorstores/supabase';
|
import { logWrapper } from '@utils/logWrapper';
|
||||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
import { logWrapper } from '../../../utils/logWrapper';
|
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
|
||||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||||
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
|
||||||
import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
||||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||||
|
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
||||||
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { metadataFilterField } from '@utils/sharedFields';
|
||||||
|
|
||||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
|
||||||
|
|
||||||
const embeddingDimensions: INodeProperties = {
|
const embeddingDimensions: INodeProperties = {
|
||||||
displayName: 'Embedding Dimensions',
|
displayName: 'Embedding Dimensions',
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue