使用 Qdrant 的完整 RAG 系统,带自动更新文档功能
高级
这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 32 个节点。主要使用 Set, Wait, GoogleDrive, HttpRequest, ManualTrigger 等节点。 使用OpenAI、Google Gemini、Qdrant和Google Drive构建自更新RAG系统
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
- •Qdrant 服务器连接信息
- •Google Gemini API Key
使用的节点 (32)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "Xof38WtIJ3CpwM2D",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "使用 Qdrant 的完整 RAG 系统,带自动更新文档功能",
"tags": [],
"nodes": [
{
"id": "478c24a7-6e2a-49bb-93ab-84e701b62dd6",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-448,
80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "414f3285-3ecb-4ea3-b4f3-b397112da952",
"name": "Embeddings OpenAI1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
944,
480
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.1
},
{
"id": "314e5293-b60c-4ac3-9eeb-b4ca66ee6b5c",
"name": "默认数据加载器1",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1088,
480
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_id",
"value": "={{ $('Get files').item.json.id }}"
},
{
"name": "file_name",
"value": "={{ $('Get files').item.json.name }}"
}
]
}
},
"dataType": "binary",
"binaryMode": "specificField"
},
"typeVersion": 1
},
{
"id": "d4620040-a7c7-43a7-a007-9ee1095a2fb1",
"name": "创建集合",
"type": "n8n-nodes-base.httpRequest",
"position": [
-144,
-48
],
"parameters": {
"url": "http:///collections/test_sparse",
"method": "PUT",
"options": {},
"jsonBody": "{\n \"vectors\": {\n \"size\": 1536,\n \"distance\": \"Cosine\" \n },\n \"sparse_vectors\": {\n \"text\": { }\n },\n \"shard_number\": 1, \n \"replication_factor\": 1, \n \"write_consistency_factor\": 1 \n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "qhny6r5ql9wwotpn",
"name": "Qdrant API (Hetzner)"
}
},
"typeVersion": 4.2
},
{
"id": "b2ba10ce-9557-4c27-b859-fb1df76c30d1",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1088,
672
],
"parameters": {
"options": {},
"chunkSize": 500,
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "0a940a8e-41b3-4261-9f7c-5e9a6db29bae",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
432,
224
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "058610f3-46aa-43ae-82c1-abf9327cd3da",
"name": "OpenAI嵌入2",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
512,
1424
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.1
},
{
"id": "8500aecb-a176-4d7b-98d4-790235fab977",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
640,
1424
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_id",
"value": "={{ $('Get file').item.json.file_id }}"
},
{
"name": "file_name",
"value": "={{ $binary.data.fileName}}"
}
]
}
},
"dataType": "binary",
"binaryMode": "specificField"
},
"typeVersion": 1
},
{
"id": "a3212d21-f3ba-4970-b7d4-cdcf91cde2ff",
"name": "递归字符文本分割器1",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
624,
1632
],
"parameters": {
"options": {},
"chunkSize": 500,
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "0561d614-e10f-40ff-8d2a-eb92f23ffd73",
"name": "设置文件ID",
"type": "n8n-nodes-base.set",
"position": [
-96,
880
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b413a226-0641-4ed8-9951-d17b6a6a9a4b",
"name": "file_id",
"type": "string",
"value": "={{ $json.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ce097e48-8cb4-4bb8-a717-1213c6134b42",
"name": "清空集合",
"type": "n8n-nodes-base.httpRequest",
"position": [
-144,
224
],
"parameters": {
"url": "http://QDRANTURL/collections/COLLECTION/points/delete",
"method": "POST",
"options": {},
"jsonBody": "{\n \"filter\": {}\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "qhny6r5ql9wwotpn",
"name": "Qdrant API (Hetzner)"
}
},
"typeVersion": 4.2
},
{
"id": "95ec291c-c9d9-42ef-945d-d06bcd6560c0",
"name": "按文件ID删除点",
"type": "n8n-nodes-base.httpRequest",
"position": [
304,
768
],
"parameters": {
"url": "http://QDRANTURL/collections/COLLECTION/points/delete",
"method": "POST",
"options": {},
"jsonBody": "={\n \"filter\": {\n \"must\": [\n {\n \"key\": \"metadata.file_id\",\n \"match\": { \"value\": \"{{$json.file_id}}\" }\n }\n ]\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "qhny6r5ql9wwotpn",
"name": "Qdrant API (Hetzner)"
}
},
"typeVersion": 4.2
},
{
"id": "eb5dbda9-f67f-4d45-b4a3-fac167d4aef2",
"name": "搜索文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
128,
224
],
"parameters": {
"filter": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultUrl": "https://drive.google.com/drive/folders/1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultName": "Test Negozio"
}
},
"options": {},
"resource": "fileFolder"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 3
},
{
"id": "a7a0d544-45f5-4f18-8b45-8b0bbdc47c5b",
"name": "等待5秒",
"type": "n8n-nodes-base.wait",
"position": [
1392,
240
],
"webhookId": "138d379f-88a5-44a1-b45b-1595a05a1eb9",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "7790b835-3dde-4b59-b0fe-e3afec02eae8",
"name": "更新文件",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
544,
1232
],
"parameters": {
"mode": "insert",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1
},
{
"id": "bf7ccb97-52a4-4d8e-87a2-f3f3de6ac6d3",
"name": "插入文件",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
1008,
240
],
"parameters": {
"mode": "insert",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1
},
{
"id": "d65cd402-d2ae-443d-91d0-c5b4979789df",
"name": "获取文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
304,
1232
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.file_id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 3
},
{
"id": "c0214dc1-ee28-40b3-a043-b1cc3465dd7b",
"name": "获取多个文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
704,
240
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 3
},
{
"id": "970e5ac0-51c9-4300-82a9-4420f152db06",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
-416
],
"parameters": {
"color": 3,
"width": 840,
"height": 220,
"content": "## 使用 Qdrant 的完整 RAG 系统,带自动更新文档功能"
},
"typeVersion": 1
},
{
"id": "12c6fa79-4b60-45df-a39f-61b8dd834fe8",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-384,
1984
],
"webhookId": "c9460030-9e23-41c4-9fcd-6c4c7fadf784",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "28373f4f-28b2-49c6-9253-173e33039ea1",
"name": "问答链",
"type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
"position": [
-64,
1984
],
"parameters": {
"options": {}
},
"typeVersion": 1.5
},
{
"id": "c126a969-d3ab-4e1f-847d-3366c56134f3",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-176,
2224
],
"parameters": {
"options": {},
"modelName": "models/gemini-1.5-flash"
},
"credentials": {
"googlePalmApi": {
"id": "0p34rXqIqy8WuoPg",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "5398d1f7-cf4f-4355-bce4-255b48d4d4ea",
"name": "向量存储检索器",
"type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
"position": [
64,
2272
],
"parameters": {
"topK": 5
},
"typeVersion": 1
},
{
"id": "1c7614d0-6067-4dca-bbd4-e35e52f44374",
"name": "Qdrant 向量存储 1",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
-64,
2480
],
"parameters": {
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "negozio-emporio-verde",
"cachedResultName": "negozio-emporio-verde"
}
},
"credentials": {
"qdrantApi": {
"id": "iyQ6MQiVaF3VMBmt",
"name": "QdrantApi account (Hetzner)"
}
},
"typeVersion": 1.1
},
{
"id": "21bb9ac3-4a70-477f-a404-df90328bff53",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
-64,
2672
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "4zwP0MSr8zkNvvV9",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "01922882-5a91-4a0d-b13d-59528467b89b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1408,
480
],
"parameters": {
"width": 520,
"height": 420,
"content": "设置为元数据:"
},
"typeVersion": 1
},
{
"id": "2f6b7fd1-5545-46cc-a7e3-7b3c4de52e0c",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
144
],
"parameters": {
"color": 4,
"width": 540,
"height": 460,
"content": "# 步骤2"
},
"typeVersion": 1
},
{
"id": "c551c56f-e43d-45dd-922e-da0858008486",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-128
],
"parameters": {
"color": 6,
"width": 880,
"height": 220,
"content": "# 步骤 1"
},
"typeVersion": 1
},
{
"id": "75d45205-087b-433f-b049-71dcb96ea750",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
928,
1392
],
"parameters": {
"width": 520,
"height": 420,
"content": "设置为元数据:"
},
"typeVersion": 1
},
{
"id": "6fa1eb40-51ec-41c2-aa67-620152e0ba6f",
"name": "更新?",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-416,
880
],
"parameters": {
"event": "fileUpdated",
"options": {
"fileType": "all"
},
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultUrl": "https://drive.google.com/drive/folders/1RO5ByPhq2yvYLmbapTNC_kKdU5lZd4W5",
"cachedResultName": "Test Negozio"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "HEy5EuZkgPZVEa9w",
"name": "Google Drive account (n3w.it)"
}
},
"typeVersion": 1
},
{
"id": "753f71fc-d71f-4b4f-82f1-df9a68784deb",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
688
],
"parameters": {
"color": 4,
"width": 400,
"height": 440,
"content": "# 步骤3"
},
"typeVersion": 1
},
{
"id": "4534f3fb-f0c5-44a6-be8e-2a41f7806ffc",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
1824
],
"parameters": {
"color": 2,
"width": 580,
"height": 120,
"content": "# 步骤4"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "2cf144b4-3a5c-4117-b946-aad6bde36ab3",
"connections": {
"Update?": {
"main": [
[
{
"node": "Set file_id",
"type": "main",
"index": 0
}
]
]
},
"Get file": {
"main": [
[
{
"node": "Update file",
"type": "main",
"index": 0
}
]
]
},
"Get files": {
"main": [
[
{
"node": "Insert file",
"type": "main",
"index": 0
}
]
]
},
"Insert file": {
"main": [
[
{
"node": "Wait 5 sec.",
"type": "main",
"index": 0
}
]
]
},
"Set file_id": {
"main": [
[
{
"node": "Delete points by file_id",
"type": "main",
"index": 0
},
{
"node": "Get file",
"type": "main",
"index": 0
}
]
]
},
"Wait 5 sec.": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Search files": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Get files",
"type": "main",
"index": 0
}
]
]
},
"Clear collection": {
"main": [
[
{
"node": "Search files",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Qdrant Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Insert file",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings OpenAI2": {
"ai_embedding": [
[
{
"node": "Update file",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Update file",
"type": "ai_document",
"index": 0
}
]
]
},
"Default Data Loader1": {
"ai_document": [
[
{
"node": "Insert file",
"type": "ai_document",
"index": 0
}
]
]
},
"Qdrant Vector Store1": {
"ai_vectorStore": [
[
{
"node": "Vector Store Retriever",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Vector Store Retriever": {
"ai_retriever": [
[
{
"node": "Question and Answer Chain",
"type": "ai_retriever",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Question and Answer Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Question and Answer Chain": {
"main": [
[]
]
},
"When chat message received": {
"main": [
[
{
"node": "Question and Answer Chain",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader1",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Create collection",
"type": "main",
"index": 0
},
{
"node": "Clear collection",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter1": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - AI RAG 检索增强, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Qdrant 的完整 RAG 系统,带自动来源引用
使用Qdrant、Gemini和OpenAI构建带自动引用的RAG系统
Set
Code
Wait
+15
29 节点Davide
人工智能
启用RAG中文档的更新功能
使用Google Drive、Qdrant和Gemini Chat构建和更新RAG系统
Set
Wait
Google Drive
+12
29 节点Davide
人工智能
基于 Mistral OCR 的完整 RAG 从 PDF 开始
使用Mistral OCR、Qdrant和Gemini AI构建PDF文档RAG系统
Set
Code
Wait
+16
34 节点Davide
人工智能
我的智能体竞技场社区竞赛
使用Qdrant、Mistral OCR和GPT-4构建基于RAG的问答系统
Set
Code
Wait
+19
41 节点Davide
内容创作
上下文混合RAG AI文案
Google Drive到Supabase上下文向量数据库同步用于RAG应用
If
Set
Code
+25
76 节点Michael Taleb
AI RAG 检索增强
将文件存储到Qdrant CLOUD Fairwork
使用OpenAI、Gemini和Qdrant处理文档并构建语义搜索
Code
Merge
Form Trigger
+13
35 节点Jez
AI RAG 检索增强
工作流信息
难度等级
高级
节点数量32
分类2
节点类型16
作者
Davide
@n3witaliaFull-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza
外部链接
在 n8n.io 查看 →
分享此工作流