8
n8n 中文网amn8n.com

使用Google Drive、Pinecone和OpenAI RAG构建文档问答系统

高级

这是一个自动化工作流,包含 19 个节点。主要使用 GoogleDrive, Agent, GoogleDriveTrigger, ChatTrigger, LmChatOpenAi 等节点。 使用Google Drive、Pinecone和OpenAI RAG构建文档问答系统

前置要求
  • Google Drive API 凭证
  • OpenAI API Key
  • Pinecone API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "79fe07f045222b356cf5ca430fe39cdf11b9fe024467e3b6b3e1a64d1a92c94f"
  },
  "nodes": [
    {
      "id": "56745855-bde9-45f2-bb9a-37c8a5544056",
      "name": "Google Drive 触发器",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -112,
        592
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "=Choose your folder"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "31b61802-30e6-4898-8a3b-881ddc96c127",
      "name": "下载文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        160,
        592
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "=Choose your folder"
        },
        "options": {},
        "operation": "download"
      },
      "typeVersion": 3
    },
    {
      "id": "4d6b1ba5-38eb-4db1-a43c-e508ad192ff3",
      "name": "Pinecone 向量存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        432,
        592
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "id",
          "value": "=Choose you index"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "3b3adc2c-f566-4c6d-8dad-2bff56fdc83d",
      "name": "OpenAI嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        160,
        1024
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3b3b0ebc-7972-4d4b-88fd-a7d9df5a30d8",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        608,
        848
      ],
      "parameters": {
        "options": {},
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "a95ab7b7-8624-4fb7-8238-45147bf8acd3",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        464,
        1056
      ],
      "parameters": {
        "options": {},
        "chunkOverlap": 100
      },
      "typeVersion": 1
    },
    {
      "id": "fd460847-a8aa-4c2d-946f-7deddfc2c64e",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1040,
        672
      ],
      "webhookId": "9be55aab-2133-42ad-ab75-2c43888786b7",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "f796fa38-a472-4c68-81b7-78874d6b47fa",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1264,
        896
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "7f2d4746-be6c-4dc3-bbf8-979a0e2cf2b5",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1392,
        896
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "677e0550-9d7f-4d55-a18e-694ca2d9ae55",
      "name": "Pinecone 向量存储1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1520,
        896
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "databases",
          "cachedResultName": "databases"
        },
        "toolDescription": "Use this as a knowledge base to answer the user message"
      },
      "typeVersion": 1.3
    },
    {
      "id": "22033102-58b8-4ec5-899c-8fc4ba290782",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        528
      ],
      "parameters": {
        "color": 5,
        "width": 1056,
        "height": 688,
        "content": "## 文档插入"
      },
      "typeVersion": 1
    },
    {
      "id": "4a3f3dc6-e6f7-4357-b0ce-538ad5c4af7b",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        960
      ],
      "parameters": {
        "color": 4,
        "width": 208,
        "height": 208,
        "content": "## 嵌入向量"
      },
      "typeVersion": 1
    },
    {
      "id": "ef37ed33-f7b8-412c-b534-0c949d48a0e1",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        544
      ],
      "parameters": {
        "width": 320,
        "height": 176,
        "content": "## 存储"
      },
      "typeVersion": 1
    },
    {
      "id": "69048fc8-1479-4efe-980d-5a40b71c2fc2",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        528
      ],
      "parameters": {
        "width": 992,
        "height": 560,
        "content": "## 在此测试"
      },
      "typeVersion": 1
    },
    {
      "id": "843bcd47-d995-4a77-b6ac-7e81dd35b0d8",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        832
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 192,
        "content": "## 获取数据库"
      },
      "typeVersion": 1
    },
    {
      "id": "b5fbdc8b-c696-417f-8e51-f03e0b65bbd8",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        528
      ],
      "parameters": {
        "width": 432,
        "height": 704,
        "content": "## 凭据设置(关键)"
      },
      "typeVersion": 1
    },
    {
      "id": "aafc6b73-18de-4934-b61b-e55556f12cd6",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        176
      ],
      "parameters": {
        "color": 4,
        "width": 672,
        "height": 336,
        "content": "### **RAG 系统**"
      },
      "typeVersion": 1
    },
    {
      "id": "b99dc201-c075-4b5c-9433-2a8e69c86404",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        80
      ],
      "parameters": {
        "color": 6,
        "width": 224,
        "height": 80,
        "content": "## 工作流构建者 [Abdullah Ahmed](https://www.youtube.com/@gureyosman06)"
      },
      "typeVersion": 1
    },
    {
      "id": "56750d09-170d-4bcb-9831-7ee9e2f8d61b",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1328,
        672
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant"
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    }
  ],
  "pinData": {},
  "connections": {
    "Download file": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类-
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Abdullahi Ahmed

Abdullahi Ahmed

@abdosman06

I'm an Automation consultant with over 1 year of experience helping businesses to streamline their processes. Use my link to book an initial consultation for custom n8n work.

外部链接
在 n8n.io 查看

分享此工作流