新增:RAG智能体终极方案:n8n+Google File Search,零门槛搭建高精度RAG工作流

This commit is contained in:
soluckysummer
2025-12-04 10:52:45 +08:00
parent 4f7ddce5bd
commit d67f60b8f6
2 changed files with 453 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@
2. B站:https://space.bilibili.com/1316597695
## 工作流列表
- [【保姆级】RAG智能体终极方案:n8n+Google File Search,零门槛搭建高精度RAG工作流!](./workflows/Google%20RAG%20Workflow%20with%20MCP.json)
- [n8n工作流外接:零代码封装成应用,突破使用限制,自由分享!](https://ailinplus-s-school.teachable.com/courses/ai/lectures/63730041)
- [n8n重磅更新:自动生成工作流,实测效果惊人,最强AI工作流生成器 | N8N Workflow Builder](./workflows/Web内容摘要与多平台文案.json)
- [免费n8n工作流:一键监控X、公众号、小红书、抖音、YouTube所有动态,保姆级教程!](./workflows/多平台数据监控(雷达)工作流.json)
+452
View File
@@ -0,0 +1,452 @@
{
"name": "Google RAG Workflow with MCP",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-240,
-256
],
"id": "c24314a5-1775-4c0e-88eb-924b0b971d9d",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"method": "POST",
"url": "https://generativelanguage.googleapis.com/v1beta/fileSearchStores",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "displayName",
"value": "空间名称"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
16,
-256
],
"id": "45b36306-8f89-4693-8eb8-c69f353c8fce",
"name": "HTTP Request",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"formTitle": "上传文件",
"formDescription": "上传文件",
"formFields": {
"values": [
{
"fieldLabel": "File",
"fieldType": "file",
"multipleFiles": false,
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.3,
"position": [
-256,
16
],
"id": "69bbee8d-0476-4c5a-adbc-ccd24476ac7f",
"name": "On form submission",
"webhookId": "27a474a3-92b9-4725-bb7c-1fd5111099cc"
},
{
"parameters": {
"method": "POST",
"url": "https://generativelanguage.googleapis.com/upload/v1beta/{空间名称}:uploadToFileSearchStore",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendBody": true,
"contentType": "binaryData",
"inputDataFieldName": "File",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
16,
16
],
"id": "f0d949dc-fbc6-4468-9d5a-9dc3ff3e2536",
"name": "HTTP Request1",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.4,
"position": [
-272,
272
],
"id": "2ab22b48-871f-40ab-91ca-715e67efcf4a",
"name": "When chat message received",
"webhookId": "49ea7558-301a-4f87-a842-7ba3c9b4003e"
},
{
"parameters": {
"options": {
"systemMessage": "=你是一个基于知识库(RAG)的智能助手。请严格依据知识库信息回答问题,确保内容真实可靠;回答时需注明信息来源。"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
-64,
272
],
"id": "711ca8f9-a350-4504-9dff-c153404af9f1",
"name": "AI Agent"
},
{
"parameters": {
"method": "POST",
"url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"contents\": [{\n \"parts\": [{\n \"text\": \"{{ $fromAI('query','Questions asked by users') }}\"\n }]\n }],\n \"tools\": [{\n \"file_search\": {\n \"file_search_store_names\": [\"空间名称\"]\n }\n }]\n}\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.3,
"position": [
144,
496
],
"id": "32cd273c-bb50-4179-b541-dc9b958f18dc",
"name": "HTTP Request2",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-144,
496
],
"id": "047a9757-651f-4998-b643-6a253276f04e",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "8TUk57xMDCMcQ7oJ",
"name": "Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"content": "## 创建知识库搜索空间",
"height": 240,
"width": 720
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
-336
],
"typeVersion": 1,
"id": "58867218-d610-4c61-a861-4446ba99705c",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## 上传知识库文档",
"height": 240,
"width": 720,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
-48
],
"typeVersion": 1,
"id": "4cc6c65a-e7fe-4f5d-9c1c-c19ced5a08c7",
"name": "Sticky Note1"
},
{
"parameters": {
"content": "## 知识库文档检索及问答",
"height": 448,
"width": 720,
"color": 6
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
224
],
"typeVersion": 1,
"id": "e1db02cc-f2f0-43ec-86e5-00065e27412c",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## 知识库文档检索及问答\n1. 介绍:https://blog.google/technology/developers/file-search-gemini-api/\n2. 接入文档示例:https://ai.google.dev/gemini-api/docs/file-search?hl=zh-cn#citations\n3. api文档:https://ai.google.dev/api/file-search/file-search-stores?hl=zh-cn#endpoint\n4. 价格及速率限制:https://ai.google.dev/gemini-api/docs/file-search?hl=zh-cn#rate-limits",
"height": 592,
"width": 736,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
704
],
"typeVersion": 1,
"id": "9d574c9c-55ed-477f-9f1d-871e94597f08",
"name": "Sticky Note3"
},
{
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/{空间名称}/documents",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
-256,
1104
],
"id": "4cce411e-482e-4e92-ae4b-a83b3985b30f",
"name": "查看指定空间文档列表",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/fileSearchStores",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
-256,
896
],
"id": "a0112148-dfea-4f7e-9b83-e517e2719d7b",
"name": "查看知识库(搜索)空间列表",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"method": "DELETE",
"url": "https://generativelanguage.googleapis.com/v1beta/{空间名称}",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "force",
"value": "true"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
48,
896
],
"id": "37a92c89-c02b-43ee-bdb2-1d9e2b5839eb",
"name": "删除知识库(搜索)空间",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
},
{
"parameters": {
"method": "DELETE",
"url": "https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*/documents/*}",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "force",
"value": "true"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
48,
1104
],
"id": "625867dc-1748-4d48-ae6d-1de4089c9d4a",
"name": "删除搜索空间文档",
"credentials": {
"httpQueryAuth": {
"id": "t6XdGcDAZ8UGFdYP",
"name": "google studio key"
}
}
}
],
"pinData": {},
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request2": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": true
},
"versionId": "9856fdb5-6411-45bc-a324-5c161d381f2f",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "667f8e49cea6f05a4f2d4764a2ef083b44c681d7bcf3709cc71f85be90eeca2e"
},
"id": "zbiU3AnGQ0OFG5Su",
"tags": []
}