init
This commit is contained in:
981
n8n-flow.json
Normal file
981
n8n-flow.json
Normal file
@@ -0,0 +1,981 @@
|
||||
{
|
||||
"name": "security-expert",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"jsonMode": "expressionData",
|
||||
"jsonData": "={{\n{\n \"content\": `${ $json.text }\\n---\\n${ $json.chunk }`\n}\n}}",
|
||||
"options": {
|
||||
"metadata": {
|
||||
"metadataValues": [
|
||||
{
|
||||
"name": "=file_id",
|
||||
"value": "={{ $('Set File ID').first().json.file_id }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "71d2a34b-9a7d-4a48-b787-098ceb80b2bf",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
2736,
|
||||
1028
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"sessionIdType": "customKey",
|
||||
"sessionKey": "={{ $json.body.sessionId }}"
|
||||
},
|
||||
"id": "a7cb76d1-96c2-4882-b9d4-94d4528570db",
|
||||
"name": "Postgres Chat Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
240,
|
||||
160
|
||||
],
|
||||
"notesInFlow": false,
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.body.chatInput }}",
|
||||
"options": {
|
||||
"systemMessage": "=## Roll\n\nDu är en säkerhetsexpert som specialiserat dig på att ge tydliga och korrekta svar på frågor relaterade till säkerhet. Du har tillgång till en samling dokument som du kan använda för att besvara frågor. Ditt mål är att tillhandahålla korrekt, aktuell och relevant information på ett professionellt och lättförståeligt sätt.\n\n## Ansvar\n\n- Svara på användarnas frågor som en erfaren säkerhetsexpert, med tydliga och förståeliga förklaringar.\n- Använd de tillgängliga dokumenten för att underbygga dina svar och ge en grund för informationen.\n- Förtydliga missuppfattningar eller felinformation relaterad till säkerhet.\n- Undvik att använda subjektiva åsikter eller spekulationer; håll dig till fakta och bevisbaserade svar.\n\n## Annan viktig information och instruktioner\n\n- Berätta alltid för användaren om du inte kunde hitta relevant information inom de givna dokumenten. Fabrikera inte svar eller gissningar.\n- Använd ett neutralt och sakligt språk. Undvik jargong eller tekniska termer om de inte är nödvändiga för att förklara en koncept. Förklara tekniska termer om det behövs.\n- Fokusera på att leverera tydliga, koncisa och korrekta svar som bygger på de tillgängliga dokumenten.\n \n## Felhantering\n\n- Om informationen inte kan hittas med hjälp av de givna instruktionerna, svara med: \"Jag är ledsen, jag kunde inte hitta relevant information baserat på mina tillgängliga resurser.\""
|
||||
}
|
||||
},
|
||||
"id": "c7d23062-4412-4a7a-8b9b-fde44a9a3f0a",
|
||||
"name": "RAG AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 1.6,
|
||||
"position": [
|
||||
168,
|
||||
-64
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {
|
||||
"reset": false
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
112,
|
||||
804
|
||||
],
|
||||
"id": "c2e91f9e-2cb0-4f56-a5da-8d386d1f0603",
|
||||
"name": "Loop Over Items"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chunkSize": 2000,
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
2816,
|
||||
1236
|
||||
],
|
||||
"id": "75cf520d-7f27-4b37-a59b-48919f66fa94",
|
||||
"name": "Recursive Character Text Splitter"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"public": true,
|
||||
"options": {}
|
||||
},
|
||||
"id": "9b069b98-8414-426b-9b2c-f5a088ac83fb",
|
||||
"name": "When chat message received",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-336,
|
||||
144
|
||||
],
|
||||
"webhookId": "43a4e54d-93b9-4c63-996a-5275cd429f09"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fieldToSplitOut": "chunks",
|
||||
"options": {
|
||||
"destinationFieldName": "chunks"
|
||||
}
|
||||
},
|
||||
"id": "2e37fa00-f233-4c4c-a7e4-85cbd2b9dfb8",
|
||||
"name": "Chunks To List",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1808,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "=<document>\n{{ $('Generate Document Summary').item.json.text }}\n</document>\nHere is the chunk we want to situate within the whole document \n<chunk> \n{{ $json.chunks }}\n</chunk> \nPlease give a short succinct context to situate this chunk within the overall document for the purposes of improving search retrieval of the chunk. Answer only with the succinct context and nothing else. "
|
||||
},
|
||||
"id": "6293b035-f7e2-4401-a790-444fee8ce85d",
|
||||
"name": "Generate Contextual Text",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"typeVersion": 1.4,
|
||||
"position": [
|
||||
2032,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "069d067c-3534-4939-8ff4-34dee02a9436",
|
||||
"name": "chunk",
|
||||
"value": "={{ $('Chunks To List').item.json.chunks }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "24e01f4f-e156-47e9-a89e-9cbdccda6bd4",
|
||||
"name": "text",
|
||||
"value": "={{ $('Generate Contextual Text').item.json.text }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "52f22988-2755-4604-9bc2-3a1644702f5f",
|
||||
"name": "Get Values",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
2384,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"tableName": "sak_documents_pg",
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
2640,
|
||||
804
|
||||
],
|
||||
"id": "8c20a2e8-37fb-4a13-94ec-bd3fa256ae4e",
|
||||
"name": "Postgres PGVector Store",
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fileSelector": "/home/node/.n8n/sakman/*.pdf",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-112,
|
||||
804
|
||||
],
|
||||
"id": "f791ae25-51f5-4d05-955d-413a87826e4d",
|
||||
"name": "Read/Write Files from Disk"
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-336,
|
||||
804
|
||||
],
|
||||
"id": "45f3be3a-9f42-4efb-9949-65a8223fc0b4",
|
||||
"name": "When clicking ‘Test workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "pdf",
|
||||
"options": {}
|
||||
},
|
||||
"id": "145343f2-231d-4b1f-99d8-6fb91f486e1d",
|
||||
"name": "Extract Document PDF",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1008,
|
||||
680
|
||||
],
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gemma3:12b",
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.lmOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
2104,
|
||||
904
|
||||
],
|
||||
"id": "dfacde36-0b50-4845-902f-55d0452cb052",
|
||||
"name": "Ollama Model",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "bge-m3:latest"
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
2608,
|
||||
1028
|
||||
],
|
||||
"id": "3f2b8630-7a43-4396-95c4-d38d9c02e8b8",
|
||||
"name": "Embeddings Ollama",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fileSelector": "=/home/node/.n8n/sakman/{{ $('Set File ID').item.json.file_id }}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
784,
|
||||
680
|
||||
],
|
||||
"id": "f0cac3d4-49ab-4012-8cf3-004082d80356",
|
||||
"name": "Read/Write Files from Disk1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "executeQuery",
|
||||
"query": "CREATE EXTENSION IF NOT EXISTS vector;\n\nDO $$\nBEGIN\n IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'documents_pg') THEN\n EXECUTE 'DELETE FROM documents_pg WHERE metadata->>''file_id'' LIKE ''%' || $1 || '%''';\n END IF;\nEND\n$$;",
|
||||
"options": {
|
||||
"queryReplacement": "={{ $json.file_id }}"
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"typeVersion": 2.5,
|
||||
"position": [
|
||||
560,
|
||||
680
|
||||
],
|
||||
"id": "c63cede5-56ca-4452-8edd-4fd93bd28e0b",
|
||||
"name": "Delete Old Doc Records",
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "10646eae-ae46-4327-a4dc-9987c2d76173",
|
||||
"name": "file_id",
|
||||
"value": "={{ $json.fileName }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "f4536df5-d0b1-4392-bf17-b8137fb31a44",
|
||||
"name": "file_type",
|
||||
"value": "={{ $json.mimeType }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "397a097b-0c5d-4fbc-b55b-e5af7c114bc7",
|
||||
"name": "Set File ID",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
336,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "PetrosStav/gemma3-tools:12b",
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
112,
|
||||
160
|
||||
],
|
||||
"id": "89fabfb5-f8a9-4677-a1ca-20600e9fbf03",
|
||||
"name": "Ollama Chat Model",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "e1a6feb7-aa55-4654-970d-4ed3f7ca80b0",
|
||||
"name": "body.sessionId",
|
||||
"value": "={{ $json.sessionId }}",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"id": "4f6084b9-fd0e-4f6a-bc27-4cc60c1b9f07",
|
||||
"name": "body.chatInput",
|
||||
"value": "={{ $json.chatInput }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
-112,
|
||||
144
|
||||
],
|
||||
"id": "acdf4a56-c30f-4c6f-9d88-b59083c2efa0",
|
||||
"name": "Edit Fields (Set Correct Fields)"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"id": "0264bd85-d8c4-425b-80d4-6225d3e2d65d",
|
||||
"name": "Respond to Webhook",
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
960,
|
||||
144
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "d264444f-c01a-4fa0-86a4-c0bf0e4c8537",
|
||||
"name": "output",
|
||||
"value": "={{ $json.output || $json.text }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.4,
|
||||
"position": [
|
||||
736,
|
||||
144
|
||||
],
|
||||
"id": "e17351ff-996d-4f70-bec9-d7b5ce2533d7",
|
||||
"name": "Edit Fields (Set Output Field)"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"toolName": "sak_documents_pg",
|
||||
"toolDescription": "Use RAG to look up information in the knowledgebase.",
|
||||
"tableName": "documents_pg",
|
||||
"topK": 10,
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
368,
|
||||
160
|
||||
],
|
||||
"id": "10c00161-b805-4799-b7de-e21ad57dd2ee",
|
||||
"name": "Document RAG Tool",
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "bge-m3:latest"
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
448,
|
||||
368
|
||||
],
|
||||
"id": "1bca7a8f-c755-4a0f-b5a9-f25c30e2f564",
|
||||
"name": "Embeddings Ollama1",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "runOnceForEachItem",
|
||||
"jsCode": "function cutStringInHalf(str) {\n if (typeof str !== 'string') {\n return null; // Handle non-string input\n }\n\n const len = str.length;\n const midpoint = Math.floor(len / 2); // Ensure integer division for proper rounding\n\n const firstHalf = str.substring(0, midpoint);\n const secondHalf = str.substring(midpoint);\n\n return {\n firstHalf: firstHalf,\n secondHalf: secondHalf\n };\n}\n\nfunction chunkStringByDoubleNewline(inputString) {\n // Split the string by occurrences of two newline characters.\n var chunks = inputString.split(/\\n\\n+/);\n\n // Remove any leading or trailing empty strings that might result from the split.\n chunks = chunks.filter(chunk => chunk.trim() !== \"\");\n\n // Trim leading and trailing newline characters from each chunk.\n chunks = chunks.map(chunk => {\n return chunk.replace(/\\n/g, '');\n });\n\n chunks = chunks.filter(chunk => chunk.length >= 50);\n\n let newChunks = new Array(); // Collect the new chunks here\n \n chunks = chunks.map(chunk => {\n if (chunk.length >= 500) {\n var halves = cutStringInHalf(chunk);\n if (halves !== null) {\n newChunks.push(halves.firstHalf);\n newChunks.push(halves.secondHalf);\n }\n }\n return chunk; // Return the original chunk; map expects a return value.\n });\n\n// Combine the original chunks with the newly created chunks.\n chunks = chunks.concat(newChunks);\n\n return chunks;\n}\n\nreturn {\n chunks: chunkStringByDoubleNewline($('Extract Document PDF').item.json.text)\n};"
|
||||
},
|
||||
"id": "63c6fb91-9bbb-4df9-83ba-e4beb1f34097",
|
||||
"name": "Create Chunks From Document",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1584,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gemma3:12b",
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.lmOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1304,
|
||||
904
|
||||
],
|
||||
"id": "4ee5dcc0-3c1e-428d-85c3-06c6b7a9208a",
|
||||
"name": "Ollama Model1",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "=<document>\n{{ $('Extract Document PDF').item.json.text }}\n</document>\nPlease give a one page succinct of the document to get an overall summary of what the document contains and nothing else."
|
||||
},
|
||||
"id": "8e4a6d17-365a-4e3f-8349-0bd0237a8ae9",
|
||||
"name": "Generate Document Summary",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"typeVersion": 1.4,
|
||||
"position": [
|
||||
1232,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"inputSource": "passthrough"
|
||||
},
|
||||
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-336,
|
||||
-496
|
||||
],
|
||||
"id": "127ed677-8ab9-4ba4-9493-653eff251e69",
|
||||
"name": "When Executed by Another Workflow"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"sessionIdType": "customKey",
|
||||
"sessionKey": "={{ $json.sessionId }}"
|
||||
},
|
||||
"id": "dfe08386-7767-487c-a612-63f5d2e9b766",
|
||||
"name": "Postgres Chat Memory1",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
16,
|
||||
-480
|
||||
],
|
||||
"notesInFlow": false,
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.chatInput }}",
|
||||
"options": {
|
||||
"systemMessage": "=## Roll\n\nDu är en säkerhetsexpert som specialiserat dig på att ge tydliga och korrekta svar på frågor relaterade till säkerhet. Du har tillgång till en samling dokument som du kan använda för att besvara frågor. Ditt mål är att tillhandahålla korrekt, aktuell och relevant information på ett professionellt och lättförståeligt sätt.\n\n## Ansvar\n\n- Svara på användarnas frågor som en erfaren säkerhetsexpert, med tydliga och förståeliga förklaringar.\n- Använd de tillgängliga dokumenten för att underbygga dina svar och ge en grund för informationen.\n- Förtydliga missuppfattningar eller felinformation relaterad till säkerhet.\n- Undvik att använda subjektiva åsikter eller spekulationer; håll dig till fakta och bevisbaserade svar.\n\n## Annan viktig information och instruktioner\n\n- Berätta alltid för användaren om du inte kunde hitta relevant information inom de givna dokumenten. Fabrikera inte svar eller gissningar.\n- Använd ett neutralt och sakligt språk. Undvik jargong eller tekniska termer om de inte är nödvändiga för att förklara en koncept. Förklara tekniska termer om det behövs.\n- Fokusera på att leverera tydliga, koncisa och korrekta svar som bygger på de tillgängliga dokumenten.\n \n## Felhantering\n\n- Om informationen inte kan hittas med hjälp av de givna instruktionerna, svara med: \"Jag är ledsen, jag kunde inte hitta relevant information baserat på mina tillgängliga resurser.\""
|
||||
}
|
||||
},
|
||||
"id": "11827873-2151-476e-99a4-bd4132230f41",
|
||||
"name": "RAG AI Agent1",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"typeVersion": 1.6,
|
||||
"position": [
|
||||
-56,
|
||||
-704
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "qwen3:14b",
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-112,
|
||||
-480
|
||||
],
|
||||
"id": "8b8e6169-f39a-4573-a97f-7cc63e8aaa30",
|
||||
"name": "Ollama Chat Model1",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "retrieve-as-tool",
|
||||
"toolName": "sak_documents_pg",
|
||||
"toolDescription": "Use RAG to look up information in the knowledgebase.",
|
||||
"tableName": "documents_pg",
|
||||
"topK": 10,
|
||||
"options": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
144,
|
||||
-480
|
||||
],
|
||||
"id": "19c2776a-3be9-40e9-a32f-7e7c0d1607bb",
|
||||
"name": "Document RAG Tool1",
|
||||
"credentials": {
|
||||
"postgres": {
|
||||
"id": "HWnE2pnEijbfPDeJ",
|
||||
"name": "Postgres account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "bge-m3:latest"
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
224,
|
||||
-272
|
||||
],
|
||||
"id": "efa0d5a8-b95e-4432-b6de-278077251fae",
|
||||
"name": "Embeddings Ollama2",
|
||||
"credentials": {
|
||||
"ollamaApi": {
|
||||
"id": "wPusCMj8AjfsC1WD",
|
||||
"name": "Ollama account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres PGVector Store",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres Chat Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"RAG AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields (Set Output Field)",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[],
|
||||
[
|
||||
{
|
||||
"node": "Set File ID",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When chat message received": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields (Set Correct Fields)",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chunks To List": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Contextual Text",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Contextual Text": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Values",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Values": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres PGVector Store",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres PGVector Store": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read/Write Files from Disk": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking ‘Test workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read/Write Files from Disk",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract Document PDF": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Document Summary",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Contextual Text",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Ollama": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Postgres PGVector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Read/Write Files from Disk1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract Document PDF",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Delete Old Doc Records": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read/Write Files from Disk1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set File ID": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Old Doc Records",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields (Set Correct Fields)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields (Set Output Field)": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Webhook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Document RAG Tool": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Ollama1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Document RAG Tool",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Create Chunks From Document": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Chunks To List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Document Summary",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Document Summary": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create Chunks From Document",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Postgres Chat Memory1": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent1",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent1",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Document RAG Tool1": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent1",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Ollama2": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Document RAG Tool1",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When Executed by Another Workflow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "RAG AI Agent1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "8bfb448b-31cb-4e55-9537-8906db759123",
|
||||
"meta": {
|
||||
"instanceId": "56ae1a2d59ed9baec7bc411d64551b10fd6fb48c6d72c5a3eadeaa975c372f27"
|
||||
},
|
||||
"id": "wNv1Le2I4hxlfMzL",
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user