{ "name": "Demo: RAG in n8n", "nodes": [ { "parameters": { "formTitle": "Upload your data to test RAG", "formFields": { "values": [ { "fieldLabel": "Upload your file(s)", "fieldType": "file", "acceptFileTypes": ".pdf, .csv", "requiredField": true } ] }, "options": {} }, "type": "n8n-nodes-base.formTrigger", "typeVersion": 2.2, "position": [ -128, 0 ], "id": "f7a656ec-83fc-4ed2-a089-57a9def662b7", "name": "Upload your file here", "webhookId": "82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d" }, { "parameters": { "model": "qwen3-embedding-8b", "options": {} }, "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi", "typeVersion": 1.2, "position": [ 560, 560 ], "id": "6ea78663-cf2f-4f2d-8e68-43047c2afd87", "name": "Embeddings OpenAI", "retryOnFail": true, "credentials": { "openAiApi": { "id": "OefcKscoTwL7Al4B", "name": "qwen3-embedding" } } }, { "parameters": { "dataType": "binary", "options": {} }, "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader", "typeVersion": 1.1, "position": [ 320, 160 ], "id": "94aecac0-03f9-4915-932b-d14a2576607b", "name": "Default Data Loader" }, { "parameters": { "content": "### Readme\nLoad your data into a vector database with the 📚 **Load Data** flow, and then use your data as chat context with the 🐕 **Retriever** flow.\n\n**Quick start**\n1. Click on the `Execute Workflow` button to run the 📚 **Load Data** flow.\n2. Click on `Open Chat` button to run the 🐕 **Retriever** flow. Then ask a question about content from your document(s)\n\n\nFor more info, check [our docs on RAG in n8n](https://docs.n8n.io/advanced-ai/rag-in-n8n/).", "height": 300, "width": 440, "color": 4 }, "type": "n8n-nodes-base.stickyNote", "position": [ -656, -64 ], "typeVersion": 1, "id": "0d07742b-0b36-4c2e-990c-266cbe6e2d4d", "name": "Sticky Note" }, { "parameters": { "content": "### 📚 Load Data Flow", "height": 460, "width": 700, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ -176, -64 ], "typeVersion": 1, "id": "d19d04f3-5231-4e47-bed7-9f24a4a8f582", "name": "Sticky Note1" }, { "parameters": { "options": { "systemMessage": "You are a helpful agent assistant. Use your tools" } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 2, "position": [ 832, -16 ], "id": "579aed76-9644-42d1-ac13-7369059ff1c2", "name": "AI Agent" }, { "parameters": { "options": {} }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.1, "position": [ 624, -16 ], "id": "9c30de61-935a-471f-ae88-ec5f67beeefc", "name": "When chat message received", "webhookId": "4091fa09-fb9a-4039-9411-7104d213f601" }, { "parameters": { "model": { "__rl": true, "value": "qwen3-vl-8b-instruct", "mode": "list", "cachedResultName": "qwen3-vl-8b-instruct" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.2, "position": [ 736, 144 ], "id": "b5aa8942-9cd5-4c2f-bd77-7a0ceb921bac", "name": "OpenAI Chat Model", "retryOnFail": true, "credentials": { "openAiApi": { "id": "EWkURzcNsgUiCLwX", "name": "qwen3-vl-8b-instruct" } } }, { "parameters": { "content": "### 🐕 2. Retriever Flow", "height": 460, "width": 680, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 608, -64 ], "typeVersion": 1, "id": "28bc73a1-e64a-47bf-ac1c-ffe644894ea5", "name": "Sticky Note2" }, { "parameters": { "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n", "height": 240, "width": 320, "color": 4 }, "type": "n8n-nodes-base.stickyNote", "position": [ 1024, 480 ], "typeVersion": 1, "id": "0cf8c647-418c-4d1a-8952-766145afca72", "name": "Sticky Note3" }, { "parameters": { "mode": "insert", "qdrantCollection": { "__rl": true, "value": "rag_collection", "mode": "id" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", "typeVersion": 1.3, "position": [ 32, 0 ], "id": "36d722cc-8784-43bf-8259-3cf4bf234051", "name": "Qdrant Vector Store", "credentials": { "qdrantApi": { "id": "XbSMrPW2VmIbrHZf", "name": "QdrantApi account" } } }, { "parameters": {}, "type": "@n8n/n8n-nodes-langchain.memoryRedisChat", "typeVersion": 1.5, "position": [ 848, 144 ], "id": "8d062e80-40cd-48fd-b723-eacd0546c745", "name": "Redis Chat Memory", "retryOnFail": true, "credentials": { "redis": { "id": "BlyPTGi1qYfvEj18", "name": "Redis account" } } }, { "parameters": { "httpMethod": "POST", "path": "openwebui-default", "authentication": "headerAuth", "responseMode": "responseNode", "options": { "rawBody": false } }, "type": "n8n-nodes-base.webhook", "typeVersion": 2.1, "position": [ -144, 528 ], "id": "68686b6a-48fc-431b-9806-de65fc4a8e76", "name": "Webhook", "webhookId": "47ef259d-3e8f-49ba-984f-aeda8d66ed5f", "credentials": { "httpHeaderAuth": { "id": "0Pro0946imqDeb4H", "name": "openwebui" } } }, { "parameters": { "options": {} }, "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.5, "position": [ 1120, -16 ], "id": "3655fc97-aaff-495b-b090-08c9a4390560", "name": "Respond to Webhook" }, { "parameters": { "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\n\nlet body\nfor (const item of $input.all()) {\n body = item.json.body;\n}\n\nreturn body;" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 208, 544 ], "id": "1599b207-4a85-40c8-9317-2a7d3118c228", "name": "Code in JavaScript" }, { "parameters": { "mode": "retrieve-as-tool", "toolDescription": "qdrant", "qdrantCollection": { "__rl": true, "value": "rag_collection", "mode": "list", "cachedResultName": "rag_collection" }, "options": {} }, "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant", "typeVersion": 1.3, "position": [ 896, 240 ], "id": "dac85688-5aae-45e0-af0a-a3aab405b536", "name": "Qdrant Vector Store1", "credentials": { "qdrantApi": { "id": "XbSMrPW2VmIbrHZf", "name": "QdrantApi account" } } } ], "pinData": {}, "connections": { "Upload your file here": { "main": [ [ { "node": "Qdrant Vector Store", "type": "main", "index": 0 } ] ] }, "Embeddings OpenAI": { "ai_embedding": [ [ { "node": "Qdrant Vector Store1", "type": "ai_embedding", "index": 0 }, { "node": "Qdrant Vector Store", "type": "ai_embedding", "index": 0 } ] ] }, "Default Data Loader": { "ai_document": [ [ { "node": "Qdrant Vector Store", "type": "ai_document", "index": 0 } ] ] }, "When chat message received": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Redis Chat Memory": { "ai_memory": [ [ { "node": "AI Agent", "type": "ai_memory", "index": 0 } ] ] }, "Webhook": { "main": [ [ { "node": "Code in JavaScript", "type": "main", "index": 0 } ] ] }, "AI Agent": { "main": [ [ { "node": "Respond to Webhook", "type": "main", "index": 0 } ] ] }, "Code in JavaScript": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Qdrant Vector Store1": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] } }, "active": true, "settings": { "executionOrder": "v1", "binaryMode": "separate", "availableInMCP": false }, "versionId": "9416dace-6ec5-4d4f-99e5-fc9a3b0452c0", "meta": { "templateId": "rag-starter-template", "templateCredsSetupCompleted": true, "instanceId": "519c4a21279760b368db9a61b54471e6b02748fc565cd17eefd96a5111b20990" }, "id": "jT3yqYJ84i2NazHC", "tags": [] }