mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Shovel around more of AI code (no-changelog) (#12218)
This commit is contained in:
committed by
GitHub
parent
a8e7a05856
commit
2ce1644d01
@@ -1,4 +1,5 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from 'langchain/document';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
type INodeExecutionData,
|
||||
@@ -6,11 +8,11 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
|
||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
// This node is deprecated. Use VectorStoreInMemory instead.
|
||||
export class VectorStoreInMemoryInsert implements INodeType {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
type INodeType,
|
||||
@@ -6,9 +7,10 @@ import {
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
|
||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
|
||||
// This node is deprecated. Use VectorStoreInMemory instead.
|
||||
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 pg from 'pg';
|
||||
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { metadataFilterField } from '@utils/sharedFields';
|
||||
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
|
||||
type CollectionOptions = {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||
import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||
import { PineconeStore } from '@langchain/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 { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||
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 {
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
@@ -5,15 +9,12 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
|
||||
import { PineconeStore } from '@langchain/pinecone';
|
||||
import { Pinecone } from '@pinecone-database/pinecone';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
|
||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||
import { pineconeIndexSearch } from '../shared/methods/listSearch';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
// This node is deprecated. Use VectorStorePinecone instead.
|
||||
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 {
|
||||
NodeConnectionType,
|
||||
type INodeType,
|
||||
@@ -5,14 +9,11 @@ import {
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
} 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 { logWrapper } from '../../../utils/logWrapper';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
||||
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
import { metadataFilterField } from '@utils/sharedFields';
|
||||
|
||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||
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 { QdrantVectorStore } from '@langchain/qdrant';
|
||||
import type { Schemas as QdrantSchemas } from '@qdrant/js-client-rest';
|
||||
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { qdrantCollectionRLC } from '../shared/descriptions';
|
||||
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 {
|
||||
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 { createClient } from '@supabase/supabase-js';
|
||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { metadataFilterField } from '@utils/sharedFields';
|
||||
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||
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 {
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
@@ -5,15 +9,12 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} 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 { processDocuments } from '../shared/processDocuments';
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
|
||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||
import { supabaseTableNameSearch } from '../shared/methods/listSearch';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
// This node is deprecated. Use VectorStoreSupabase instead.
|
||||
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 {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
@@ -5,13 +9,11 @@ import {
|
||||
type SupplyData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import type { SupabaseLibArgs } from '@langchain/community/vectorstores/supabase';
|
||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
||||
|
||||
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
import { metadataFilterField } from '@utils/sharedFields';
|
||||
|
||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||
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 { 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 { metadataFilterField } from '../../../utils/sharedFields';
|
||||
|
||||
const embeddingDimensions: INodeProperties = {
|
||||
displayName: 'Embedding Dimensions',
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
@@ -5,10 +8,9 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
|
||||
import type { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
// This node is deprecated. Use VectorStoreZep instead.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import {
|
||||
NodeConnectionType,
|
||||
type INodeType,
|
||||
@@ -5,12 +8,10 @@ import {
|
||||
type ISupplyDataFunctions,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
|
||||
import { getMetadataFiltersValues } from '@utils/helpers';
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
import { metadataFilterField } from '@utils/sharedFields';
|
||||
|
||||
// This node is deprecated. Use VectorStoreZep instead.
|
||||
export class VectorStoreZepLoad implements INodeType {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { OpenAIEmbeddings } from '@langchain/openai';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
|
||||
import { MemoryVectorStoreManager } from './MemoryVectorStoreManager';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
|
||||
describe('MemoryVectorStoreManager', () => {
|
||||
it('should create an instance of MemoryVectorStoreManager', () => {
|
||||
|
||||
@@ -19,12 +19,13 @@ import type {
|
||||
INodePropertyOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { getMetadataFiltersValues, logAiEvent } from '@utils/helpers';
|
||||
import { logWrapper } from '@utils/logWrapper';
|
||||
import type { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
|
||||
import { processDocument } from './processDocuments';
|
||||
import { getMetadataFiltersValues, logAiEvent } from '../../../utils/helpers';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import type { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
||||
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
||||
|
||||
type NodeOperationMode = 'insert' | 'load' | 'retrieve' | 'update';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApplicationError, type IDataObject, type ILoadOptionsFunctions } from 'n8n-workflow';
|
||||
import { Pinecone } from '@pinecone-database/pinecone';
|
||||
import { QdrantClient } from '@qdrant/js-client-rest';
|
||||
import { ApplicationError, type IDataObject, type ILoadOptionsFunctions } from 'n8n-workflow';
|
||||
|
||||
export async function pineconeIndexSearch(this: ILoadOptionsFunctions) {
|
||||
const credentials = await this.getCredentials('pineconeApi');
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { INodeExecutionData } from 'n8n-workflow';
|
||||
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
||||
|
||||
import { N8nBinaryLoader } from '@utils/N8nBinaryLoader';
|
||||
import { N8nJsonLoader } from '@utils/N8nJsonLoader';
|
||||
|
||||
export async function processDocuments(
|
||||
documentInput: N8nJsonLoader | N8nBinaryLoader | Array<Document<Record<string, unknown>>>,
|
||||
|
||||
Reference in New Issue
Block a user