基于Voyage-Context-3嵌入和MongoDB Atlas的文档问答系统
高级
这是一个Engineering, AI RAG领域的自动化工作流,包含 53 个节点。主要使用 Set, Code, Wait, Merge, MongoDb 等节点。 基于Voyage-Context-3嵌入和MongoDB Atlas的文档问答系统
前置要求
- •MongoDB 连接字符串
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (53)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "cc8db825-4ae4-4795-b3d3-a858af3d62c7",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-320,
-336
],
"parameters": {},
"typeVersion": 1
},
{
"id": "37a7e1ab-e3f3-4588-92a9-6a3bdf4335dc",
"name": "导入研究论文",
"type": "n8n-nodes-base.httpRequest",
"position": [
336,
-336
],
"parameters": {
"url": "={{ $('Set Variables').first().json.url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "34c48356-2d29-41a2-902b-9512bb9bf3c8",
"name": "从文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
512,
-336
],
"parameters": {
"options": {
"joinPages": false
},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "7a1609c6-19f7-41e0-9054-aa10d31e4529",
"name": "拆分页面",
"type": "n8n-nodes-base.splitOut",
"position": [
688,
-336
],
"parameters": {
"options": {},
"fieldToSplitOut": "text"
},
"typeVersion": 1
},
{
"id": "bbb632c2-a98c-4727-82f1-7a2ddd6cab89",
"name": "页面引用",
"type": "n8n-nodes-base.noOp",
"position": [
1808,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9bb0b5a0-bc3a-4d56-92cb-9287f6dd18f3",
"name": "分块页面文本",
"type": "n8n-nodes-base.code",
"position": [
2096,
-208
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const chunks = [];\nconst chunkSize = 1000;\nconst chunkOverlap = 0; // Voyage recommends no overlap for contextual embeddings\nconst text = $input.item.json.text.replace(/\\n/, '');\n\nfor (let i=0,j=Math.round(text.length/chunkSize)+1;i<j;i++) {\n chunks.push(\n text.substr(\n Math.max(0,(i * chunkSize)-chunkOverlap),\n chunkSize\n )\n );\n}\n\nreturn { chunks };"
},
"typeVersion": 2
},
{
"id": "cbe2e982-7c4a-48e7-aa2a-3b9615d41deb",
"name": "Voyage-Context-3 嵌入",
"type": "n8n-nodes-base.httpRequest",
"position": [
2288,
-208
],
"parameters": {
"url": "https://api.voyageai.com/v1/contextualizedembeddings",
"method": "POST",
"options": {},
"jsonBody": "={{\n{\n \"inputs\": $input.all().map(item => item.json.chunks.compact()),\n \"input_type\": \"document\",\n \"model\": \"voyage-context-3\"\n}\n}}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "VYN3hfgfq62zjN0I",
"name": "Voyage.ai"
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "dfd6df48-a0a6-4995-925b-6dbe8dd58747",
"name": "拆分输出",
"type": "n8n-nodes-base.splitOut",
"position": [
2480,
-208
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "4dcbc327-0880-4f3b-9ba1-f6951f95b988",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1584,
0
],
"parameters": {
"options": {},
"batchSize": 3
},
"typeVersion": 3
},
{
"id": "19775d9b-fe97-4078-8ef5-252f45796e2c",
"name": "合并内容与向量",
"type": "n8n-nodes-base.set",
"position": [
3184,
-208
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bba20778-dbf9-459b-a1aa-97a76ba01713",
"name": "text",
"type": "string",
"value": "={{ $('Chunk Page Text').all()[$runIndex].json.chunks[$itemIndex] }}"
},
{
"id": "20069d1a-4893-4823-9b39-9c61e2e88bee",
"name": "embeddings",
"type": "array",
"value": "={{ $json.embedding }}"
},
{
"id": "26d237a5-5991-4deb-867d-07b5bda6d2c2",
"name": "metadata",
"type": "object",
"value": "={{\n{\n \"pageNumber\": $('Page Ref').first().json.pageNumber,\n \"url\": $('Page Ref').first().json.url\n}\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "98e580fe-8db3-4e9d-bffd-1034cc8e61a1",
"name": "子工作流触发器",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
1360,
0
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "text"
},
{
"name": "url"
},
{
"name": "pageNumber",
"type": "number"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "206e4cc4-693f-40df-8c37-45822dd953b5",
"name": "批次 10",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1216,
-336
],
"parameters": {
"options": {},
"batchSize": 10
},
"typeVersion": 3
},
{
"id": "2460bcd5-950a-4fbd-96eb-5428e03a32fb",
"name": "调用嵌入子工作流",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1440,
-336
],
"parameters": {
"options": {
"waitForSubWorkflow": true
},
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $workflow.id }}"
},
"workflowInputs": {
"value": {
"url": "={{ $('Set Variables').first().json.url }}",
"text": "={{ $json.text }}",
"pageNumber": "={{ $json.pageNumber }}"
},
"schema": [
{
"id": "text",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "text",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "pageNumber",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "pageNumber",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"page"
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "f044e091-b50c-4686-9f0a-e0abeb1022a0",
"name": "完成",
"type": "n8n-nodes-base.set",
"position": [
4016,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e2c34b5b-2a3e-4fcd-a639-4d72368b783a",
"name": "response",
"type": "string",
"value": "ok"
}
]
}
},
"executeOnce": true,
"typeVersion": 3.4
},
{
"id": "e52fa239-18e7-4ea9-93d2-010dd3555fa6",
"name": "Voyage-Context-3 嵌入1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1328,
528
],
"parameters": {
"url": "https://api.voyageai.com/v1/contextualizedembeddings",
"method": "POST",
"options": {},
"jsonBody": "={{\n{\n \"inputs\": [\n [\n $('Get Query').first().json.query\n + ' '\n + $('Aggregate Answers').item.json.answers.map(item => item.chatInput).join(' ')\n ]\n ],\n \"input_type\": \"query\",\n \"model\": \"voyage-context-3\"\n}\n}}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "VYN3hfgfq62zjN0I",
"name": "Voyage.ai"
}
},
"executeOnce": false,
"typeVersion": 4.2
},
{
"id": "6f3c7ef8-891e-4dd4-bbf0-4adf6e193532",
"name": "执行相似性搜索",
"type": "n8n-nodes-base.mongoDb",
"position": [
1520,
528
],
"parameters": {
"query": "={{\n([\n {\n \"$vectorSearch\": {\n \"index\": \"vector_index\",\n \"path\": \"embeddings\",\n \"queryVector\": $json.data[0].data[0].embedding,\n \"numCandidates\": 150,\n \"limit\": 10\n }\n },\n {\n \"$project\": {\n \"_id\": 0,\n \"text\": 1,\n \"metadata\": 1,\n \"score\": {\n \"$meta\": \"vectorSearchScore\"\n }\n }\n }\n]).toJsonString()\n}}",
"operation": "aggregate",
"collection": "documents"
},
"credentials": {
"mongoDb": {
"id": "OUucWo4Fut06mJ1J",
"name": "MongoDB account"
}
},
"typeVersion": 1.2
},
{
"id": "1a41d58f-b8fc-498f-a807-ffc3edd400ed",
"name": "添加页码",
"type": "n8n-nodes-base.set",
"position": [
848,
-336
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "3103cd6a-5932-432a-8859-7dd14d496258",
"name": "pageNumber",
"type": "number",
"value": "={{ $itemIndex + 1 }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "5af13dae-29e2-4f6f-a8e8-96cf9d01569e",
"name": "设置变量",
"type": "n8n-nodes-base.set",
"position": [
-144,
-336
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7ff25027-cfa5-4f63-8b13-05a724c5bb96",
"name": "url",
"type": "string",
"value": "https://arxiv.org/pdf/2402.06196"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e57a9115-5bb4-469b-9e1c-57e8747c9e79",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
1664,
-336
],
"webhookId": "739dc127-4870-4b0c-ada6-e62729935ba2",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "5877e228-c02c-41c1-9fd5-a76f47414ba0",
"name": "获取查询",
"type": "n8n-nodes-base.set",
"position": [
-80,
528
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a197e69a-0f22-45ab-9b57-535e80fe12af",
"name": "query",
"type": "string",
"value": "={{ $json.chatInput }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "60f7b22e-e56e-43c6-9651-c36d6bb6fa17",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
1712,
528
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "d0a430ed-c2a2-4331-98b7-b1929cfe591f",
"name": "查询引用",
"type": "n8n-nodes-base.noOp",
"position": [
800,
704
],
"parameters": {},
"typeVersion": 1
},
{
"id": "fe490208-25a9-4504-97b8-bbf3ce3e0b60",
"name": "遍历问题",
"type": "n8n-nodes-base.splitInBatches",
"position": [
592,
528
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "f30d70b4-42d3-48f4-b44d-0f48dd2d459a",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
176,
672
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "609d43c1-e536-49c7-8470-2c23763302ec",
"name": "生成澄清问题",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
96,
528
],
"parameters": {
"text": "={{ $json.query }}",
"options": {
"systemPromptTemplate": "You are a helpful assistant helping a user research a paper titled \"Large Language Models: A Survey\".\n\nYour task is to generate 2 clarifying questions for the user's query so that later search queries can be better refined."
},
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n \"required\": [\"questions\"],\n\t\"properties\": {\n\t\t\"questions\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t}\n\t\t}\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "35132610-83bb-4582-ad42-8e3954ea234f",
"name": "拆分问题",
"type": "n8n-nodes-base.splitOut",
"position": [
400,
528
],
"parameters": {
"options": {
"destinationFieldName": "question"
},
"fieldToSplitOut": "output.questions"
},
"typeVersion": 1
},
{
"id": "70b2e1bb-c868-4adc-b21a-a9e95d166198",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-336,
528
],
"webhookId": "c2a1187e-7e13-4506-9fcc-527c978a0966",
"parameters": {
"public": true,
"options": {
"responseMode": "responseNodes"
}
},
"typeVersion": 1.3
},
{
"id": "5cba1271-764b-48ea-81b8-1bf5f2b2f813",
"name": "等待回答",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
992,
704
],
"parameters": {
"message": "={{ $json.question }}",
"options": {}
},
"typeVersion": 1
},
{
"id": "581a9f27-dc41-40c2-8d91-ace13e3675a0",
"name": "快速确认",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
992,
528
],
"parameters": {
"message": "Thanks. Please wait whilst I search the relevant document.",
"options": {},
"waitUserReply": false
},
"typeVersion": 1
},
{
"id": "0c9b0917-b3c2-4c8d-9825-1db4e07b8449",
"name": "聚合答案",
"type": "n8n-nodes-base.aggregate",
"position": [
800,
528
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData",
"destinationFieldName": "answers"
},
"typeVersion": 1
},
{
"id": "ea32ae52-d7ec-4f35-8ef8-04842d3cce72",
"name": "响应用户",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
2640,
528
],
"parameters": {
"message": "={{ $json.message.content.answer }}",
"options": {},
"waitUserReply": false
},
"typeVersion": 1
},
{
"id": "931f6b89-1c5a-4865-a0cc-3264795ef498",
"name": "RAG 代理",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
2304,
528
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are a helpful assistant. The user session involves answering user question against a research paper. Refer and use only the <documents> context to answer the user questions."
},
{
"role": "assistant",
"content": "=<documents>{{ $json.data.toJsonString() }}</document>"
},
{
"content": "={{\n$('Get Query').first().json.query\n + ' '\n + $('Aggregate Answers').first().json.answers.map(item => item.chatInput).join(' ')\n}}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "9ded06c0-e7a1-4c5e-82c8-a432347b7b90",
"name": "按页码获取文档",
"type": "n8n-nodes-base.mongoDbTool",
"position": [
2384,
672
],
"parameters": {
"query": "={\n \"metadata.pageNumber\": {{ $fromAI(\"pageNumber\", \"the page number to fetch\", \"number\") }}\n \"embedding\": { \"$exists\": false } // Second condition: ensure 'embedding' key does not exist\n },\n {\n \"text\": 1,\n \"metadata\": 1\n }",
"options": {},
"collection": "documents",
"descriptionType": "manual",
"toolDescription": "Call this tool to fetch a full document page by pageNumber. This could be useful for more deep dive context."
},
"credentials": {
"mongoDb": {
"id": "OUucWo4Fut06mJ1J",
"name": "MongoDB account"
}
},
"typeVersion": 1.2
},
{
"id": "32dd62cd-f55b-4f43-907f-687e30b91e20",
"name": "合并内容与元数据",
"type": "n8n-nodes-base.set",
"position": [
3360,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bba20778-dbf9-459b-a1aa-97a76ba01713",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "26d237a5-5991-4deb-867d-07b5bda6d2c2",
"name": "metadata",
"type": "object",
"value": "={{\n{\n \"pageNumber\": $json.pageNumber,\n \"url\": $json.url\n}\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "cc7eab07-bae3-4838-bdca-45db86e2c734",
"name": "插入文档页面",
"type": "n8n-nodes-base.mongoDb",
"position": [
3536,
0
],
"parameters": {
"fields": "text,metadata",
"options": {},
"operation": "insert",
"collection": "documents"
},
"credentials": {
"mongoDb": {
"id": "OUucWo4Fut06mJ1J",
"name": "MongoDB account"
}
},
"typeVersion": 1.2
},
{
"id": "4d8c2a48-252a-4fe3-8ada-74bb02098347",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
3840,
0
],
"parameters": {
"mode": "chooseBranch"
},
"typeVersion": 3.2
},
{
"id": "c68e573f-ea44-4ed4-b60c-d27cf8d00d4d",
"name": "快速更新",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
1904,
528
],
"parameters": {
"message": "={{\n(function(numResults) {\n const replies = [\n `Okay, I've found ${numResults} result${numResults === 1 ? '' : 's'}.`,\n `Summarizing ${numResults} result${numResults === 1 ? '' : 's'}...`,\n `Okay, give me a second to review these ${numResults} result${numResults === 1 ? '' : 's'}`\n ];\n return replies[Math.floor((Math.random() * replies.length) + 1)];\n}($json.data.length))\n}}",
"options": {},
"waitUserReply": false
},
"typeVersion": 1
},
{
"id": "1fe9a7c0-40e6-4150-8741-f6fcc9532013",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
-544
],
"parameters": {
"color": 7,
"width": 624,
"height": 448,
"content": "## 1. 全新开始"
},
"typeVersion": 1
},
{
"id": "ed5cb8a7-381d-430d-a30f-15d04f60b35b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-544
],
"parameters": {
"color": 7,
"width": 800,
"height": 448,
"content": "## 2. 下载论文并拆分为页面"
},
"typeVersion": 1
},
{
"id": "72a31986-7c5e-4600-8c97-63e5cd92a2c1",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-544
],
"parameters": {
"color": 7,
"width": 832,
"height": 448,
"content": "## 3. 对于大型文档,使用子工作流以获得更好性能"
},
"typeVersion": 1
},
{
"id": "0918ad0c-7c8e-473f-900f-194c617132c0",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1968,
-544
],
"parameters": {
"color": 7,
"width": 736,
"height": 640,
"content": "## 4. 使用 Voyage-Context-3 进行上下文嵌入"
},
"typeVersion": 1
},
{
"id": "89b50026-e35d-40cb-9c16-9094d36f7ae3",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2736,
-544
],
"parameters": {
"color": 7,
"width": 1024,
"height": 768,
"content": "## 5. 存储向量和完整页面文本以进行高级 RAG 搜索"
},
"typeVersion": 1
},
{
"id": "f7c73904-bf8a-4b7f-bd07-17e43e1bd51d",
"name": "插入文档向量",
"type": "n8n-nodes-base.mongoDb",
"position": [
3360,
-208
],
"parameters": {
"fields": "text,embeddings,metadata",
"options": {},
"operation": "insert",
"collection": "documents"
},
"credentials": {
"mongoDb": {
"id": "OUucWo4Fut06mJ1J",
"name": "MongoDB account"
}
},
"typeVersion": 1.2
},
{
"id": "f43c511b-b0fc-43a0-b870-dc74175469fa",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
272
],
"parameters": {
"color": 7,
"width": 1328,
"height": 640,
"content": "## 6. 提出澄清问题以进行上下文搜索"
},
"typeVersion": 1
},
{
"id": "43848d5f-2b2c-4698-8aef-940b9b968ade",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1216,
272
],
"parameters": {
"color": 7,
"width": 880,
"height": 640,
"content": "## 2. 使用 Voyage-Context-3 进行 MongoDB Atlas 向量搜索"
},
"typeVersion": 1
},
{
"id": "72773183-6b21-4726-88aa-4c5dc09fd8b6",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2128,
272
],
"parameters": {
"color": 7,
"width": 784,
"height": 640,
"content": "## 3. 使用 OpenAI GPT-4.1-Mini 的问答代理"
},
"typeVersion": 1
},
{
"id": "ce5101b3-4ec0-4dcf-804e-1cc9f72a8b6e",
"name": "清空集合",
"type": "n8n-nodes-base.mongoDb",
"position": [
32,
-336
],
"parameters": {
"query": "={ \"metadata.url\": \"{{ $json.url }}\" }",
"operation": "delete",
"collection": "documents"
},
"credentials": {
"mongoDb": {
"id": "OUucWo4Fut06mJ1J",
"name": "MongoDB account"
}
},
"typeVersion": 1.2
},
{
"id": "f9ed9fd9-d85a-43fd-b87c-4e30c9fdab72",
"name": "对每个组",
"type": "n8n-nodes-base.splitInBatches",
"position": [
2832,
-208
],
"parameters": {
"options": {
"reset": "={{ $('For Each Group').context.done }}"
}
},
"typeVersion": 3
},
{
"id": "edb8c7d0-d909-42b9-bfd3-17e0c3c59efe",
"name": "无操作,什么都不做",
"type": "n8n-nodes-base.noOp",
"position": [
3536,
-368
],
"parameters": {},
"typeVersion": 1
},
{
"id": "027cca87-9697-4923-88d4-23df75ae4d0e",
"name": "拆分输出1",
"type": "n8n-nodes-base.splitOut",
"position": [
3008,
-208
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "5fbf397a-9054-42e0-890b-28b514e20c99",
"name": "聚合1",
"type": "n8n-nodes-base.aggregate",
"position": [
3536,
-208
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "2a706685-6ed5-4760-9127-db8608dc542d",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1184,
-720
],
"parameters": {
"width": 608,
"height": 944,
"content": "## 使用 Voyage-Context-3 和 Mongo Atlas 进行上下文分块嵌入"
},
"typeVersion": 1
},
{
"id": "cb267ec0-1267-4968-ac5d-0bc17cd09807",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1184,
256
],
"parameters": {
"width": 608,
"height": 336,
"content": ""
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Done": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Batch 10",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Done",
"type": "main",
"index": 0
}
]
]
},
"Batch 10": {
"main": [
[],
[
{
"node": "Call Embeddings Subworkflow",
"type": "main",
"index": 0
}
]
]
},
"Page Ref": {
"main": [
[
{
"node": "Chunk Page Text",
"type": "main",
"index": 0
},
{
"node": "Combine Content & Metadata",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Quick Update",
"type": "main",
"index": 0
}
]
]
},
"Get Query": {
"main": [
[
{
"node": "Generate Clarifying Questions",
"type": "main",
"index": 0
}
]
]
},
"Query Ref": {
"main": [
[
{
"node": "Wait for Answer",
"type": "main",
"index": 0
}
]
]
},
"RAG Agent": {
"main": [
[
{
"node": "Respond to User",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "For Each Group",
"type": "main",
"index": 0
}
]
]
},
"Aggregate1": {
"main": [
[
{
"node": "For Each Group",
"type": "main",
"index": 0
}
]
]
},
"Split Out1": {
"main": [
[
{
"node": "Combine Content & Vectors",
"type": "main",
"index": 0
}
]
]
},
"Split Pages": {
"main": [
[
{
"node": "Add Page Number",
"type": "main",
"index": 0
}
]
]
},
"Quick Update": {
"main": [
[
{
"node": "RAG Agent",
"type": "main",
"index": 0
}
]
]
},
"Set Variables": {
"main": [
[
{
"node": "Clear Collection",
"type": "main",
"index": 0
}
]
]
},
"For Each Group": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"Add Page Number": {
"main": [
[
{
"node": "Batch 10",
"type": "main",
"index": 0
}
]
]
},
"Chunk Page Text": {
"main": [
[
{
"node": "Voyage-Context-3 Embeddings",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Page Ref",
"type": "main",
"index": 0
}
]
]
},
"Split Questions": {
"main": [
[
{
"node": "Loop Over Questions",
"type": "main",
"index": 0
}
]
]
},
"Wait for Answer": {
"main": [
[
{
"node": "Loop Over Questions",
"type": "main",
"index": 0
}
]
]
},
"Clear Collection": {
"main": [
[
{
"node": "Import Research Paper",
"type": "main",
"index": 0
}
]
]
},
"Aggregate Answers": {
"main": [
[
{
"node": "Quick Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Split Pages",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Generate Clarifying Questions",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Quick Confirmation": {
"main": [
[
{
"node": "Voyage-Context-3 Embeddings1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Questions": {
"main": [
[
{
"node": "Aggregate Answers",
"type": "main",
"index": 0
}
],
[
{
"node": "Query Ref",
"type": "main",
"index": 0
}
]
]
},
"Subworkflow Trigger": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Insert Document Page": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Import Research Paper": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Insert Documents Vectors": {
"main": [
[
{
"node": "Aggregate1",
"type": "main",
"index": 0
}
]
]
},
"No Operation, do nothing": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Combine Content & Vectors": {
"main": [
[
{
"node": "Insert Documents Vectors",
"type": "main",
"index": 0
}
]
]
},
"Perform Similarity Search": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Combine Content & Metadata": {
"main": [
[
{
"node": "Insert Document Page",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Get Query",
"type": "main",
"index": 0
}
]
]
},
"Call Embeddings Subworkflow": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Voyage-Context-3 Embeddings": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Voyage-Context-3 Embeddings1": {
"main": [
[
{
"node": "Perform Similarity Search",
"type": "main",
"index": 0
}
]
]
},
"Fetch Document By Page Number": {
"ai_tool": [
[
{
"node": "RAG Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Generate Clarifying Questions": {
"main": [
[
{
"node": "Split Questions",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Set Variables",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 工程, AI RAG 检索增强
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用Kimi-K2、Gemini嵌入和Qdrant构建文档RAG系统
使用Kimi-K2、Gemini嵌入和Qdrant构建文档RAG系统
Set
Split Out
Qdrant
+14
35 节点Jimleuk
文档提取
视觉RAG与图像嵌入,使用Cohere Command-A和Embed v4
视觉RAG与图像嵌入,使用Cohere Command-A和Embed v4
If
Set
Split Out
+16
38 节点Jimleuk
文档提取
上下文混合RAG AI文案
Google Drive到Supabase上下文向量数据库同步用于RAG应用
If
Set
Code
+25
76 节点Michael Taleb
AI RAG 检索增强
使用 n8n、Apify 和 OpenAI o3 自托管 AI 深度研究代理
使用 n8n、Apify 和 OpenAI o3 自托管 AI 深度研究代理
If
Set
Code
+20
87 节点Jimleuk
人工智能
YouTube RAG 搜索前端(使用 Apify、Qdrant 和 AI)
基于 Apify、Qdrant 和 AI 的 YouTube RAG 搜索前端
If
Set
Html
+23
62 节点Jimleuk
人工智能
工作流信息
难度等级
高级
节点数量53
分类2
节点类型21
作者
Jimleuk
@jimleukFreelance AI Automation Engineer based in London, UK. Since 2024, my n8n templates have documented my journey into applied AI and have helped hundreds of businesses and organisations get up to speed with AI automation. Today, I continue to explore use-cases as AI evolves and occasionally upload templates which I find novel and interesting. Subscribe to the RSS Feed: https://cdn.subworkflow.ai/n8n-templates/rss.xml
外部链接
在 n8n.io 查看 →
分享此工作流