8
n8n 한국어amn8n.com

RAG 재정렬

고급

이것은Internal Wiki, AI RAG분야의자동화 워크플로우로, 26개의 노드를 포함합니다.주로 Code, GoogleDrive, ManualTrigger, Agent, ExtractFromFile 등의 노드를 사용하며. Supabase, OpenAI 및 Cohere 리랭커를 사용하여 문서에서 질문에 답변

사전 요구사항
  • Google Drive API 인증 정보
  • OpenAI API Key
  • Supabase URL과 API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "p8bHqYEvjtOrvz3q",
  "meta": {
    "instanceId": "",
    "templateCredsSetupCompleted": true
  },
  "name": "RAG Reranking",
  "tags": [],
  "nodes": [
    {
      "id": "d690d954-6291-4355-9b51-42fe9ab2791a",
      "name": "파일 다운로드",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -100,
        -320
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "list",
          "value": "16ahWlNwBvd53xFHA4UUh6EbkFd8ogxBv",
          "cachedResultUrl": "https://drive.google.com/file/d/16ahWlNwBvd53xFHA4UUh6EbkFd8ogxBv/view?usp=drivesdk",
          "cachedResultName": "Rules_of_Golf_Simplified.pdf"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "V2ewjiHO0o6xhQ2R",
          "name": "nateherk88@gmail.com"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ad9a4d3c-ace1-428c-8957-edb456bf864f",
      "name": "기본 데이터 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        460,
        -180
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "ruleNumber",
                "value": "={{ $json.ruleNumber }}"
              }
            ]
          }
        },
        "jsonData": "={{ $('Code').item.json.fullText }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f6d44c38-8cb4-43ad-8130-7ab8cd142c9a",
      "name": "파일에서 추출",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        40,
        -320
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "dfc604ab-b7bd-4a08-b65d-f8fe2c3b5c13",
      "name": "코드",
      "type": "n8n-nodes-base.code",
      "position": [
        180,
        -320
      ],
      "parameters": {
        "jsCode": "// n8n Code Node - Split Golf Rules\n// This code takes the input text and splits it into separate items for each rule\n\n// Get the input text from the first item\nconst inputText = $input.first().json.text;\n\n// Split the text by \"Rule\" pattern, keeping the \"Rule\" text with each section\nconst ruleSections = inputText.split(/(?=Rule \\d+)/);\n\n// Remove the first empty element (everything before the first \"Rule\")\nconst cleanedSections = ruleSections.filter(section => section.trim().startsWith('Rule'));\n\n// Create output items - one for each rule\nconst outputItems = cleanedSections.map((ruleText, index) => {\n  // Extract rule number from the text\n  const ruleMatch = ruleText.match(/Rule (\\d+)/);\n  const ruleNumber = ruleMatch ? ruleMatch[1] : (index + 1).toString();\n  \n  // Extract rule title (everything between \"Rule X –\" and the first numbered item)\n  const titleMatch = ruleText.match(/Rule \\d+ – (.+?)(?=\\n1\\.|\\n\\d+\\.)/);\n  const ruleTitle = titleMatch ? titleMatch[1].trim() : 'Unknown Rule';\n  \n  return {\n    json: {\n      ruleNumber: ruleNumber,\n      ruleTitle: ruleTitle,\n      fullText: ruleText.trim(),\n      originalIndex: index\n    }\n  };\n});\n\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "cc659be4-709e-4d59-a386-d7cc60166293",
      "name": "채팅 메시지 수신 시",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -280,
        -1180
      ],
      "webhookId": "79772045-628b-4cf6-b2ec-cecceca9fe24",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "9f02235d-8c3f-4309-bd14-d4c6bcdfab11",
      "name": "GPT 4.1-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -100,
        -1040
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "fpo6OUh9TcHg29jk",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dad869f9-4c1d-44a4-b523-31f007efccc7",
      "name": "Cohere 재정렬기",
      "type": "@n8n/n8n-nodes-langchain.rerankerCohere",
      "position": [
        520,
        -1040
      ],
      "parameters": {},
      "credentials": {
        "cohereApi": {
          "id": "vCsqiDhFNdSGhDKu",
          "name": "CohereApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "24cbdd3d-afee-46d2-83ef-888d432b4874",
      "name": "Supabase에 업로드",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        320,
        -320
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "queryName": "match_documents"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        }
      },
      "credentials": {
        "supabaseApi": {
          "id": "r1eLu64ie9Tz6yOK",
          "name": "Demo 2.22.25"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f80184cb-fc7e-40d7-bf2d-a723350c9f0f",
      "name": "Supabase 벡터 저장소",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        360,
        -1180
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 20,
        "options": {},
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        },
        "useReranker": true,
        "toolDescription": "Use this tool to search the database"
      },
      "credentials": {
        "supabaseApi": {
          "id": "r1eLu64ie9Tz6yOK",
          "name": "Demo 2.22.25"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "de08fce1-3db6-4452-a30a-27294328bdb9",
      "name": "GPT 4.1-mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        220,
        -600
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "fpo6OUh9TcHg29jk",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2fbb1dbc-aeb3-4f5d-b1b1-f8947bec45e4",
      "name": "Cohere 재정렬기1",
      "type": "@n8n/n8n-nodes-langchain.rerankerCohere",
      "position": [
        780,
        -620
      ],
      "parameters": {},
      "credentials": {
        "cohereApi": {
          "id": "vCsqiDhFNdSGhDKu",
          "name": "CohereApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "64140fce-9e7c-4cd2-a5ba-2bfb4c8bdaad",
      "name": "OpenAI2 임베딩",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        620,
        -620
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "WnxUhaEPMn5hIsEp",
          "name": "Demo 4/2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fe882466-73db-4141-8c70-baff299b4e1c",
      "name": "Supabase 벡터 저장소1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        620,
        -760
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 20,
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "ruleNumber",
                "value": "={{ $('Metadata Agent').item.json.output }}"
              }
            ]
          }
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        },
        "useReranker": true,
        "toolDescription": "Use this tool to search the database"
      },
      "credentials": {
        "supabaseApi": {
          "id": "r1eLu64ie9Tz6yOK",
          "name": "Demo 2.22.25"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "12e4fe9d-d97d-4252-a235-66017fadad66",
      "name": "스티커 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -460
      ],
      "parameters": {
        "color": 2,
        "width": 1000,
        "height": 440,
        "content": "# Vectorize Document w/ Metadata\n(this code node is set up for the golf rules PDF specifically)"
      },
      "typeVersion": 1
    },
    {
      "id": "406521ff-0f01-4688-a352-62ae49d71ff6",
      "name": "스티커 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -1280
      ],
      "parameters": {
        "color": 4,
        "width": 620,
        "height": 380,
        "content": "# RAG Agent\n"
      },
      "typeVersion": 1
    },
    {
      "id": "11f6a7fd-b540-43d9-ad55-86c2874e8ddd",
      "name": "스티커 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -1280
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 380,
        "content": "## Vector Store w/ Reranker\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d295d851-b64b-41c9-9289-f7c5c640b704",
      "name": "OpenAI1 임베딩",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        300,
        -180
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "WnxUhaEPMn5hIsEp",
          "name": "Demo 4/2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5b11e4ea-c497-4d18-8dfe-3dcdcadde1e6",
      "name": "OpenAI 임베딩",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        360,
        -1040
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "WnxUhaEPMn5hIsEp",
          "name": "Demo 4/2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "62282da2-0dc5-4758-8182-13a7bf1afff9",
      "name": "메타데이터 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -220,
        -760
      ],
      "parameters": {
        "options": {
          "systemMessage": "=# Overview\nYour job is to understand the rule number that the human is requesting and output only the number.\n\n## Example\nInput - what's rule number 27?\nOutput - 27"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9fbd11cd-195d-4bbe-aa81-718c063d1133",
      "name": "RAG 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -80,
        -1180
      ],
      "parameters": {
        "options": {
          "systemMessage": "=# Overview\nYou are an AI agent who is an expert at the rules of golf. You will receive a question from the human, and you must use your tool called \"Supabase Vector Store\" in order to retrieve information from the database to make sure you are answering the question accurately. "
        }
      },
      "typeVersion": 2
    },
    {
      "id": "150a92c9-fdb4-45e0-a838-45364dd6140b",
      "name": "RAG 에이전트 2",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        200,
        -760
      ],
      "parameters": {
        "text": "={{ $('When chat message received').item.json.chatInput }}",
        "options": {
          "systemMessage": "=# Overview\nYou are an AI agent who is an expert at the rules of golf. You will receive a question from the human, and you must use your tool called \"Supabase Vector Store\" in order to retrieve information from the database to make sure you are answering the question accurately. "
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "e149b963-2f39-472b-962a-12bdd270e63b",
      "name": "스티커 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -880
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 400,
        "content": "# RAG Agent\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ede1b0d8-d402-4fa5-abe0-8ee4169be45b",
      "name": "스티커 노트4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -880
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 400,
        "content": "## Vector Store w/ Reranker & Metadata\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c56cce9d-2d8c-4942-94fa-a8d62e062842",
      "name": "스티커 노트5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -880
      ],
      "parameters": {
        "color": 6,
        "width": 440,
        "height": 400,
        "content": "# Metadata Agent\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7e6dd534-9f8a-42c2-bac0-0bb0e4fa99e6",
      "name": "수동 트리거",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -240,
        -320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "85ee82ce-f0b2-49f0-852e-9b888b9235a9",
      "name": "스티커 노트6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -1280
      ],
      "parameters": {
        "width": 700,
        "height": 800,
        "content": "# 🛠️ Setup Guide  \n**Author:** [Nate Herk](https://www.youtube.com/@nateherk)\n\nFollow the steps below to get your Retrieval-Augmented Generation (RAG) workflow up and running:\n\n### ✅ Step 1: Connect Your [Supabase](https://supabase.com/) Vector Store  \nEnsure your Supabase instance is ready and accessible. This will store your embedded documents with metadata.\nHere is a [video tutorial](https://youtu.be/JjBofKJnYIU) on setting that up.\n\n### ✅ Step 2: Connect Your [OpenAI](https://platform.openai.com/account/api-keys) Embeddings  \nUse the `text-embedding-3-small` or similar model for embedding your documents. Make sure your API key is active.\n\n### ✅ Step 3: Connect Your [OpenAI API Key](https://platform.openai.com/account/api-keys)  \nThis powers your embedding generation model. Add it via the HTTP Request node or a credential.\n\n### ✅ Step 4: Add Your [OpenRouter](https://openrouter.ai/) API Key  \nUse this for your main RAG agent—add your key via HTTP request or credential node.\n\n### ✅ Step 5: Connect a [Cohere](https://dashboard.cohere.com/api-keys) Re-Ranker  \nThe re-ranker improves answer quality. Add your API key for better relevance ranking on retrieved documents.\n\n### ✅ Step 6: Vectorize Documents with Metadata  \nEnsure your data ingestion process tags documents with meaningful metadata before vectorization. This helps with structured retrieval.\n\n### 💬 Final Step: Start Chatting  \nPrompt your agent and test the RAG flow end-to-end—watch it pull context-rich answers from your vector store.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "80eccd78-53ac-4cca-aedd-63ddf77ff7af",
  "connections": {
    "dfc604ab-b7bd-4a08-b65d-f8fe2c3b5c13": {
      "main": [
        [
          {
            "node": "24cbdd3d-afee-46d2-83ef-888d432b4874",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9f02235d-8c3f-4309-bd14-d4c6bcdfab11": {
      "ai_languageModel": [
        [
          {
            "node": "9fbd11cd-195d-4bbe-aa81-718c063d1133",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "d690d954-6291-4355-9b51-42fe9ab2791a": {
      "main": [
        [
          {
            "node": "f6d44c38-8cb4-43ad-8130-7ab8cd142c9a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de08fce1-3db6-4452-a30a-27294328bdb9": {
      "ai_languageModel": [
        [
          {
            "node": "150a92c9-fdb4-45e0-a838-45364dd6140b",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "62282da2-0dc5-4758-8182-13a7bf1afff9",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "7e6dd534-9f8a-42c2-bac0-0bb0e4fa99e6": {
      "main": [
        [
          {
            "node": "d690d954-6291-4355-9b51-42fe9ab2791a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "62282da2-0dc5-4758-8182-13a7bf1afff9": {
      "main": [
        [
          {
            "node": "150a92c9-fdb4-45e0-a838-45364dd6140b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dad869f9-4c1d-44a4-b523-31f007efccc7": {
      "ai_reranker": [
        [
          {
            "node": "f80184cb-fc7e-40d7-bf2d-a723350c9f0f",
            "type": "ai_reranker",
            "index": 0
          }
        ]
      ]
    },
    "2fbb1dbc-aeb3-4f5d-b1b1-f8947bec45e4": {
      "ai_reranker": [
        [
          {
            "node": "fe882466-73db-4141-8c70-baff299b4e1c",
            "type": "ai_reranker",
            "index": 0
          }
        ]
      ]
    },
    "5b11e4ea-c497-4d18-8dfe-3dcdcadde1e6": {
      "ai_embedding": [
        [
          {
            "node": "f80184cb-fc7e-40d7-bf2d-a723350c9f0f",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "f6d44c38-8cb4-43ad-8130-7ab8cd142c9a": {
      "main": [
        [
          {
            "node": "dfc604ab-b7bd-4a08-b65d-f8fe2c3b5c13",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d295d851-b64b-41c9-9289-f7c5c640b704": {
      "ai_embedding": [
        [
          {
            "node": "24cbdd3d-afee-46d2-83ef-888d432b4874",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "64140fce-9e7c-4cd2-a5ba-2bfb4c8bdaad": {
      "ai_embedding": [
        [
          {
            "node": "fe882466-73db-4141-8c70-baff299b4e1c",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "ad9a4d3c-ace1-428c-8957-edb456bf864f": {
      "ai_document": [
        [
          {
            "node": "24cbdd3d-afee-46d2-83ef-888d432b4874",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "f80184cb-fc7e-40d7-bf2d-a723350c9f0f": {
      "ai_tool": [
        [
          {
            "node": "9fbd11cd-195d-4bbe-aa81-718c063d1133",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "fe882466-73db-4141-8c70-baff299b4e1c": {
      "ai_tool": [
        [
          {
            "node": "150a92c9-fdb4-45e0-a838-45364dd6140b",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "cc659be4-709e-4d59-a386-d7cc60166293": {
      "main": [
        [
          {
            "node": "9fbd11cd-195d-4bbe-aa81-718c063d1133",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 내부 위키, AI RAG

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수26
카테고리2
노드 유형12
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

저자
외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34