8
n8n 中文网amn8n.com

使用Qdrant RAG和Ollama构建本地AI Kaggle竞赛助手

高级

这是一个Engineering, AI领域的自动化工作流,包含 23 个节点。主要使用 Set, Merge, Switch, Markdown, ReadWriteFile 等节点,结合人工智能技术实现智能自动化。 使用Qdrant RAG和Ollama构建本地AI Kaggle竞赛助手

前置要求
  • Qdrant 服务器连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "13a0050774c7f2acc1474b06f046215039c01087a78215e5a78461e6efc6cb1a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "70b42807-a6c6-4159-b278-e77311727798",
      "name": "本地文件触发器",
      "type": "n8n-nodes-base.localFileTrigger",
      "position": [
        -3060,
        -40
      ],
      "parameters": {
        "path": "C:\\\\ipynb\\\\loadme",
        "events": [
          "add"
        ],
        "options": {
          "usePolling": true,
          "followSymlinks": true,
          "awaitWriteFinish": true
        },
        "triggerOn": "folder"
      },
      "typeVersion": 1
    },
    {
      "id": "893f1157-6c00-4b8e-b726-462ab371fadf",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -1500,
        300
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "9a9bfcee-1966-415c-a59f-552e1f35aae9",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        -1360,
        440
      ],
      "parameters": {
        "options": {},
        "chunkSize": 40,
        "chunkOverlap": 10
      },
      "typeVersion": 1
    },
    {
      "id": "a7c971a5-39ac-4715-9e1b-a56af9713b06",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        -3040,
        180
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6b7d26f9-3a38-417e-85d0-4e9d42476465",
              "name": "path",
              "type": "string",
              "value": "=C:\\\\ipynb\\\\loadme\\\\"
            },
            {
              "id": "bb4471c7-d894-4739-99a6-4be247794ffa",
              "name": "filename",
              "type": "string",
              "value": "={{ $json.path.split('\\\\').last() }}"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "6384792b-de76-4e43-b26e-12c2d15c2dd2",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1740,
        260
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "db4de019-755e-4b91-ac70-f30825f14033",
      "name": "获取文件类型",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2620,
        80
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "html",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "75188d2f-4bea-44ea-a579-9b9a1bd1ea93",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.fileType }}",
                    "rightValue": "html"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4c56a14c-6c56-4cc1-b7fb-a09caa3d646d",
      "name": "导入文件",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -2840,
        80
      ],
      "parameters": {
        "options": {},
        "fileSelector": "={{ $json.path }}{{ $json.filename }}"
      },
      "typeVersion": 1
    },
    {
      "id": "c14a711f-29ab-475f-aeff-3a070c797537",
      "name": "从 TEXT 提取",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -2440,
        80
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1
    },
    {
      "id": "22ff782e-c612-4928-9033-111cf516d07e",
      "name": "摘要链",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        -2040,
        -20
      ],
      "parameters": {
        "options": {
          "summarizationMethodAndPrompts": {
            "values": {
              "summarizationMethod": "refine"
            }
          }
        },
        "chunkSize": 4000
      },
      "typeVersion": 2
    },
    {
      "id": "70fa17a5-3ec9-4a81-86bc-503581505ea1",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3100,
        -180
      ],
      "parameters": {
        "color": 7,
        "width": 995,
        "height": 554,
        "content": "## 步骤 1. 监视文件夹并导入新文档"
      },
      "typeVersion": 1
    },
    {
      "id": "a51cc8ac-e310-4825-adc6-fc57c68c09aa",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2060,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 824,
        "height": 770,
        "content": "## 步骤 2. 总结并向量化文档内容"
      },
      "typeVersion": 1
    },
    {
      "id": "6d59dc6a-692a-4752-a811-8b3033898fa4",
      "name": "Qdrant 向量存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        -1600,
        60
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "id",
          "value": "test_rag"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "wqHGuxoW5RJJYSIl",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f75f45cd-4aed-48a2-bb09-5db20b00a029",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        -2260,
        80
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "34fdd670-f568-4351-81c7-79fde68b8192",
      "name": "嵌入 Ollama",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        -1560,
        420
      ],
      "parameters": {
        "model": "mxbai-embed-large:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "jBqODDnXWJw9rGcS",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4c4f71db-e496-4528-b0e5-dc5ffb27a2e8",
      "name": "Ollama 摘要器",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "position": [
        -1900,
        140
      ],
      "parameters": {
        "model": "ALIENTELLIGENCE/contentsummarizer:latest",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "id": "jBqODDnXWJw9rGcS",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0a2954cc-bec6-4750-ae75-6362761e41b6",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -3020,
        540
      ],
      "webhookId": "9dd3e051-58a3-4c46-bd41-58c001f009f9",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "1ebe053c-0e26-44c6-b543-756ad551b99d",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2840,
        540
      ],
      "parameters": {
        "options": {
          "systemMessage": "This is a helpful and exacting data science LLM model and master Kaggle python programmer.\n\nIf Kaggle contest requirements are given from the chat input; first deeply research the problem.\n\nAccess the tool: \"previous_entry\" when preparing your background research.\n\nThen Ask any needed questions to clarify and understand the requirements necessary to build a program to address the challenge.\n\nReview your proposed program for errors and bugs.\n\nThen present the program.\n\nIf errors are returned; then iteratively debug with the chat user."
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "e042ec84-3bb6-466f-9957-0509a181d61b",
      "name": "向量存储工具",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        -2580,
        740
      ],
      "parameters": {
        "name": "previous_entry",
        "description": "={{ $('When chat message received').item.json.chatInput }}"
      },
      "typeVersion": 1
    },
    {
      "id": "fbae9bc0-6ea4-4a26-ad76-eb84bc5d06c2",
      "name": "窗口缓冲内存",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -2760,
        780
      ],
      "parameters": {
        "contextWindowLength": 15
      },
      "typeVersion": 1.3
    },
    {
      "id": "2f567628-fd1d-406b-aec7-46684bd6f5e6",
      "name": "Qdrant 向量存储2",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        -2680,
        920
      ],
      "parameters": {
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "test_rag",
          "cachedResultName": "test_rag"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "wqHGuxoW5RJJYSIl",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3aea837f-7676-45da-b6b1-fb2f6c5f8cd9",
      "name": "Ollama 聊天模型3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        -2900,
        760
      ],
      "parameters": {
        "model": "qwen3:8b",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "id": "jBqODDnXWJw9rGcS",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a9298132-e5b9-44a2-9928-a1adf7cf9fc4",
      "name": "嵌入 Ollama2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        -2660,
        1080
      ],
      "parameters": {
        "model": "mxbai-embed-large:latest"
      },
      "credentials": {
        "ollamaApi": {
          "id": "jBqODDnXWJw9rGcS",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a1c71691-8e41-4633-a1ab-4991833fb7c6",
      "name": "Ollama 聊天模型4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        -2360,
        900
      ],
      "parameters": {
        "model": "qwen3:8b",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "id": "jBqODDnXWJw9rGcS",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "Summarization Chain",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "Import File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Import File": {
      "main": [
        [
          {
            "node": "Get FileType",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get FileType": {
      "main": [
        [
          {
            "node": "Extract from TEXT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from TEXT": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Summarizer": {
      "ai_languageModel": [
        [
          {
            "node": "Summarization Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama2": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Local File Trigger": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "main": [
        []
      ]
    },
    "Summarization Chain": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store2": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "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)可能需要您自行付费。

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

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

外部链接
在 n8n.io 查看

分享此工作流