8
n8n 中文网amn8n.com

产品推荐RAG

高级

这是一个Lead Nurturing, AI RAG领域的自动化工作流,包含 17 个节点。主要使用 GoogleSheets, ManualTrigger, SplitInBatches, Agent, ChatTrigger 等节点。 使用OpenAI、Qdrant和Google表格RAG将医疗症状匹配到产品

前置要求
  • Google Sheets API 凭证
  • OpenAI API Key
  • Qdrant 服务器连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "npjeGNOHqwXLz1AX",
  "meta": {
    "instanceId": "b50483b2122f6dc268662b45507d575d939570ea8e1e086601ebb3b6273c1cfd",
    "templateCredsSetupCompleted": true
  },
  "name": "产品推荐 RAG",
  "tags": [],
  "nodes": [
    {
      "id": "ab7e0eb2-1a72-4dee-8b6a-c6a836fce257",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        -16
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "8882b64e-5caf-4a05-a7f3-d78b93d9f30c",
      "name": "RAG 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -896,
        160
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "3788a0b5-4f73-4bd1-bdca-b659a49710f5",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        176,
        192
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ec896b04-a5cc-4cc4-b7ce-3b552e2fe258",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -32
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "cc6b47eb-87b1-44a8-8319-c5a0254b83ba",
      "name": "Qdrant 向量数据库",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        256,
        544
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "6b5d2b60-f65a-4075-b5a6-415c1fb1dcc8",
      "name": "创建嵌入向量",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        192,
        752
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "9db5b8ae-a9c9-4465-a426-71bb9cda333d",
      "name": "在向量数据库中正确设置数据",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        384,
        784
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "186a5ebf-57fd-4aa4-8031-89c503603431",
      "name": "将文本分割成块",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "position": [
        464,
        960
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b969d3a6-f663-46bd-9207-666861aa4e49",
      "name": "创建嵌入向量2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -560,
        640
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "37d1974e-0e65-441d-9a22-977035e6e1af",
      "name": "遍历每个产品",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        800,
        192
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "d6cff138-2513-4acd-bf37-3e6691b3cf07",
      "name": "从 Qdrant 数据库获取数据",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        -656,
        464
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "bf1668c5-cc6a-4ab3-9f97-e9cd701df1ed",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1120,
        160
      ],
      "webhookId": "07f045cb-bfbf-4f9d-a1dd-4a57a2e3d7f8",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "e05d5065-dec0-435e-a65d-e4f831541388",
      "name": "OpenAI LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -976,
        384
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e14dc3fe-f0e4-479b-ad7e-d5477d478e20",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        96
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "95f86512-e0f7-48e0-bb44-9b727ecb320a",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "672df8d1-81bd-4709-b7be-76cf04c92593",
      "name": "存储聊天记录",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -816,
        384
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "28d9b9f0-0b67-4828-b502-71e6f7c55ad8",
      "name": "获取所有产品",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        416,
        192
      ],
      "parameters": {},
      "typeVersion": 4.6
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3cc040a0-9a81-4134-ae19-3efbfb3a8133",
  "connections": {
    "RAG Agent": {
      "main": [
        []
      ]
    },
    "OpenAI LLM": {
      "ai_languageModel": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Store Chats": {
      "ai_memory": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Create Embedding": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Database",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Get all products": {
      "main": [
        [
          {
            "node": "Loop over each product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Embedding2": {
      "ai_embedding": [
        [
          {
            "node": "Get data from Qdrant database",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Loop over each product": {
      "main": [
        [],
        [
          {
            "node": "Qdrant Vector Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Database": {
      "main": [
        [
          {
            "node": "Loop over each product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split text into chunks": {
      "ai_textSplitter": [
        [
          {
            "node": "Set Data Properly in vector database",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "RAG Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get data from Qdrant database": {
      "ai_tool": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Set Data Properly in vector database": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Database",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get all products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户培育, AI RAG 检索增强

需要付费吗?

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

工作流信息
难度等级
高级
节点数量17
分类2
节点类型12
难度说明

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

作者
Zain Ali

Zain Ali

@zain104

Software Engineer with over 3+ years of experience in full-stack development.

外部链接
在 n8n.io 查看

分享此工作流