使用简单向量存储、表单触发器和OpenAI的RAG入门模板
中级
这是一个Building Blocks, AI领域的自动化工作流,包含 12 个节点。主要使用 FormTrigger, Agent, ChatTrigger, LmChatOpenAi, EmbeddingsOpenAi 等节点,结合人工智能技术实现智能自动化。 使用简单向量存储、表单触发器和OpenAI的RAG入门模板
前置要求
- •OpenAI API Key
使用的节点 (12)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "257476b1ef58bf3cb6a46e65fac7ee34a53a5e1a8492d5c6e4da5f87c9b82833"
},
"nodes": [
{
"id": "83ed351e-90e8-458f-a01b-73001ef1800f",
"name": "在此处上传您的文件",
"type": "n8n-nodes-base.formTrigger",
"position": [
220,
-120
],
"webhookId": "82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d",
"parameters": {
"options": {},
"formTitle": "Upload your data to test RAG",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "Upload your file(s)",
"requiredField": true,
"acceptFileTypes": ".pdf, .csv"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "26d63e24-2592-41f9-9b4b-edab81e99f21",
"name": "OpenAI嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
860,
360
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "14",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "3a69c8a7-bf95-4de2-84b0-ae2cc3d2e4e7",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
660,
40
],
"parameters": {
"options": {},
"dataType": "binary"
},
"typeVersion": 1.1
},
{
"id": "0b42832b-c9e8-4627-b36c-94fc5e242b33",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-320,
-180
],
"parameters": {
"color": 4,
"width": 440,
"height": 300,
"content": "### 自述文件"
},
"typeVersion": 1
},
{
"id": "f902ab8f-4620-4a95-86f7-c5857c4d6c4f",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
-180
],
"parameters": {
"color": 7,
"width": 700,
"height": 460,
"content": "### 📚 加载数据流程"
},
"typeVersion": 1
},
{
"id": "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d",
"name": "将数据插入存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
400,
-120
],
"parameters": {
"mode": "insert",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key",
"cachedResultName": "vector_store_key"
}
},
"typeVersion": 1.2
},
{
"id": "ce86b41b-7e1b-458f-ab13-d6b187854ae8",
"name": "查询数据工具",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
1280,
80
],
"parameters": {
"mode": "retrieve-as-tool",
"toolName": "knowledge_base",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key"
},
"toolDescription": "Use this knowledge base to answer questions from the user"
},
"typeVersion": 1.2
},
{
"id": "0039537b-558c-4fe8-9716-f8aa13676f4a",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1280,
-140
],
"parameters": {
"options": {}
},
"typeVersion": 2
},
{
"id": "2669a65e-f0f3-45aa-95c0-621b15a4fc67",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
1060,
-140
],
"webhookId": "4091fa09-fb9a-4039-9411-7104d213f601",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "d43cf585-4192-4f53-9532-4677923289ba",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1060,
80
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "3d1b3f5a-bc35-4739-a618-9c85820d39a0",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
-180
],
"parameters": {
"color": 7,
"width": 680,
"height": 460,
"content": "### 🐕 2. 检索器流程"
},
"typeVersion": 1
},
{
"id": "8d4c68cf-64d1-4b3a-bb19-2f003303c1df",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1000,
320
],
"parameters": {
"color": 4,
"width": 320,
"height": 240,
"content": "### 嵌入"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Query Data Tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Insert Data to Store",
"type": "ai_embedding",
"index": 0
},
{
"node": "Query Data Tool",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Insert Data to Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Upload your file here": {
"main": [
[
{
"node": "Insert Data to Store",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 构建模块, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用多模型问答工具节省RAG工作流成本
使用多模型问答工具节省RAG工作流成本
Form Trigger
Agent
Chat Trigger
+6
13 节点Niklas Hatje
构建模块
高级AI演示(在AI开发者第14次聚会中展示)
高级AI演示(在AI开发者第14次聚会中展示)
If
Code
Gmail
+19
39 节点Max Tkacz
构建模块
构建首个WhatsApp聊天机器人
构建首个WhatsApp聊天机器人
Switch
Whats App
Http Request
+12
28 节点Jimleuk
销售
Agent Milvus工具
使用Milvus向量数据库进行Paul Graham文章搜索与聊天
Html
Limit
Split Out
+10
21 节点Cheney Zhang
其他
[AOE] 收件箱和日历管理 Agent
使用 Gmail、Google Calendar 和 GPT-4o AI 自动化邮件与日历管理
Code
Gmail
Gmail Tool
+17
38 节点AOE Agent Lab
人工智能
使用OpenAI评估RAG响应准确性:文档基础性指标
使用OpenAI评估RAG响应准确性:文档基础性指标
Set
Evaluation
Http Request
+13
25 节点Jimleuk
工程
工作流信息
难度等级
中级
节点数量12
分类2
节点类型8
作者
n8n Team
@n8n-teamMeet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.
外部链接
在 n8n.io 查看 →
分享此工作流