mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
refactor: Update Langchain to 0.1.41 & add support for Claude 3 (#8825)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
type INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { MemoryVectorStoreManager } from '../shared/MemoryVectorStoreManager';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||
import type { PineconeLibArgs } from 'langchain/vectorstores/pinecone';
|
||||
import { PineconeStore } from 'langchain/vectorstores/pinecone';
|
||||
import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||
import { PineconeStore } from '@langchain/pinecone';
|
||||
import { Pinecone } from '@pinecone-database/pinecone';
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
@@ -87,11 +87,10 @@ export const VectorStorePinecone = createVectorStoreNode({
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: credentials.apiKey as string,
|
||||
environment: credentials.environment as string,
|
||||
});
|
||||
|
||||
const pineconeIndex = client.Index(index);
|
||||
const config: PineconeLibArgs = {
|
||||
const config: PineconeStoreParams = {
|
||||
namespace: options.pineconeNamespace ?? undefined,
|
||||
pineconeIndex,
|
||||
filter,
|
||||
@@ -111,10 +110,9 @@ export const VectorStorePinecone = createVectorStoreNode({
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: credentials.apiKey as string,
|
||||
environment: credentials.environment as string,
|
||||
});
|
||||
|
||||
const indexes = (await client.listIndexes()).map((i) => i.name);
|
||||
const indexes = ((await client.listIndexes()).indexes ?? []).map((i) => i.name);
|
||||
|
||||
if (!indexes.includes(index)) {
|
||||
throw new NodeOperationError(context.getNode(), `Index ${index} not found`, {
|
||||
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import { PineconeStore } from 'langchain/vectorstores/pinecone';
|
||||
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 { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
import { pineconeIndexRLC } from '../shared/descriptions';
|
||||
@@ -115,7 +116,6 @@ export class VectorStorePineconeInsert implements INodeType {
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: credentials.apiKey as string,
|
||||
environment: credentials.environment as string,
|
||||
});
|
||||
|
||||
const pineconeIndex = client.Index(index);
|
||||
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
type INodeTypeDescription,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import type { PineconeLibArgs } from 'langchain/vectorstores/pinecone';
|
||||
import { PineconeStore } from 'langchain/vectorstores/pinecone';
|
||||
import type { PineconeStoreParams } from '@langchain/pinecone';
|
||||
import { PineconeStore } from '@langchain/pinecone';
|
||||
import { Pinecone } from '@pinecone-database/pinecone';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { getMetadataFiltersValues } from '../../../utils/helpers';
|
||||
@@ -99,11 +100,10 @@ export class VectorStorePineconeLoad implements INodeType {
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: credentials.apiKey as string,
|
||||
environment: credentials.environment as string,
|
||||
});
|
||||
|
||||
const pineconeIndex = client.Index(index);
|
||||
const config: PineconeLibArgs = {
|
||||
const config: PineconeStoreParams = {
|
||||
namespace: namespace || undefined,
|
||||
pineconeIndex,
|
||||
filter: getMetadataFiltersValues(this, itemIndex),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type INodeProperties } from 'n8n-workflow';
|
||||
import type { QdrantLibArgs } from 'langchain/vectorstores/qdrant';
|
||||
import { QdrantVectorStore } from 'langchain/vectorstores/qdrant';
|
||||
import type { QdrantLibArgs } from '@langchain/community/vectorstores/qdrant';
|
||||
import { QdrantVectorStore } from '@langchain/community/vectorstores/qdrant';
|
||||
import type { Schemas as QdrantSchemas } from '@qdrant/js-client-rest';
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { qdrantCollectionRLC } from '../shared/descriptions';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NodeOperationError, type INodeProperties } from 'n8n-workflow';
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase';
|
||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
import { supabaseTableNameRLC } from '../shared/descriptions';
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase';
|
||||
import { SupabaseVectorStore } from '@langchain/community/vectorstores/supabase';
|
||||
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
type SupplyData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import type { SupabaseLibArgs } from 'langchain/vectorstores/supabase';
|
||||
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase';
|
||||
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';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IDataObject, INodeProperties } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
import type { IZepConfig } from 'langchain/vectorstores/zep';
|
||||
import { ZepVectorStore } from 'langchain/vectorstores/zep';
|
||||
import type { IZepConfig } from '@langchain/community/vectorstores/zep';
|
||||
import { ZepVectorStore } from '@langchain/community/vectorstores/zep';
|
||||
import { createVectorStoreNode } from '../shared/createVectorStoreNode';
|
||||
import { metadataFilterField } from '../../../utils/sharedFields';
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import {
|
||||
type INodeExecutionData,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
import { ZepVectorStore } from 'langchain/vectorstores/zep';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Document } from 'langchain/document';
|
||||
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 { processDocuments } from '../shared/processDocuments';
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import {
|
||||
type INodeTypeDescription,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import type { IZepConfig } from 'langchain/vectorstores/zep';
|
||||
import { ZepVectorStore } from 'langchain/vectorstores/zep';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
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';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import { MemoryVectorStore } from 'langchain/vectorstores/memory';
|
||||
|
||||
export class MemoryVectorStoreManager {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import type { VectorStore } from 'langchain/vectorstores/base';
|
||||
import type { VectorStore } from '@langchain/core/vectorstores';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeCredentialDescription,
|
||||
@@ -13,8 +13,8 @@ import type {
|
||||
ILoadOptionsFunctions,
|
||||
INodeListSearchResult,
|
||||
} from 'n8n-workflow';
|
||||
import type { Embeddings } from 'langchain/embeddings/base';
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Embeddings } from '@langchain/core/embeddings';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import type { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import type { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
||||
|
||||
@@ -7,12 +7,11 @@ export async function pineconeIndexSearch(this: ILoadOptionsFunctions) {
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: credentials.apiKey as string,
|
||||
environment: credentials.environment as string,
|
||||
});
|
||||
|
||||
const indexes = await client.listIndexes();
|
||||
|
||||
const results = indexes.map((index) => ({
|
||||
const results = (indexes.indexes ?? []).map((index) => ({
|
||||
name: index.name,
|
||||
value: index.name,
|
||||
}));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Document } from 'langchain/document';
|
||||
import type { Document } from '@langchain/core/documents';
|
||||
import type { INodeExecutionData } from 'n8n-workflow';
|
||||
import { N8nJsonLoader } from '../../../utils/N8nJsonLoader';
|
||||
import { N8nBinaryLoader } from '../../../utils/N8nBinaryLoader';
|
||||
|
||||
Reference in New Issue
Block a user