RAG-Chatbot mit Google Drive

Experte

Dies ist ein Miscellaneous, AI RAG, Multimodal AI-Bereich Automatisierungsworkflow mit 20 Nodes. Hauptsächlich werden Set, Supabase, GoogleDrive, SplitInBatches, Agent und andere Nodes verwendet. RAG-Wissens-Chatbot mit OpenAI, Google Drive und Supabase bauen

Voraussetzungen
  • Supabase URL und API Key
  • Google Drive API-Anmeldedaten
  • OpenAI API Key
  • PostgreSQL-Datenbankverbindungsdaten
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "id": "6naAx0wcjHZbs2pM",
  "meta": {
    "instanceId": "d4f16bea1a8eb4bd7217a4d0fe9a09f643e7227b28772e65da5a86a149783124",
    "templateCredsSetupCompleted": true
  },
  "name": "RAG chatbot using Google Drive",
  "tags": [],
  "nodes": [
    {
      "id": "4191c842-b484-467e-bea5-d2ff44af79e0",
      "name": "Komplette Setup-Anleitung",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -176
      ],
      "parameters": {
        "color": 2,
        "width": 760,
        "height": 908,
        "content": "## 🚀 COMPLETE SETUP GUIDE - READ FIRST!\n\n### Step 1: Required Services\n1. **Google Drive** - For document storage\n2. **OpenAI Account** - For embeddings and chat (API key required)\n3. **Supabase Account** - For vector database (free tier OK)\n4. **PostgreSQL Database** - For chat memory (can use Supabase or separate)\n\n### Step 2: Supabase Vector Database Setup\nRun these SQL commands in Supabase SQL editor:\nhttps://supabase.com/docs/guides/ai/langchain?database-method=sql\n\n### Step 3: Credentials Setup\n1. **Google Drive OAuth2** - Enable Drive API, create OAuth2 credentials\n2. **OpenAI API** - Get API key from OpenAI dashboard\n3. **Supabase API** - Get URL and service role key from project settings\n4. **PostgreSQL** - Use Supabase connection string or separate DB\n\n### Step 4: Configure Workflow\n1. Update Google Drive folder IDs in both trigger nodes\n2. Ensure all credential connections are set\n3. Test with a single PDF file first\n\n### Step 5: Testing\n1. Upload a document to your Google Drive folder\n2. Check Supabase documents table for new entries\n3. Activate workflow and test chat interface\n4. Ask questions about your document content\n\n### 📋 Quick Checklist:\n☐ Supabase database and functions created\n☐ Google Drive folder IDs configured\n☐ All 4 credentials added to n8n\n☐ Test PDF uploaded to Drive folder\n☐ Workflow activated successfully\n☐ Chat interface responding correctly"
      },
      "typeVersion": 1
    },
    {
      "id": "5e8a89f6-ef3c-4691-959f-e1a6870f8b97",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -176
      ],
      "parameters": {
        "color": 4,
        "width": 2020,
        "height": 820,
        "content": "## Data Ingestion: Adding Google Drive PDF files to Vector DB"
      },
      "typeVersion": 1
    },
    {
      "id": "e833cbb0-3dde-4d15-bd0d-ee3d53b976c0",
      "name": "Datei aktualisiert",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        976,
        192
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_FOLDER_ID",
          "cachedResultName": "Your Watch Folder"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0b1d7b3b-1840-4f82-b4e8-3f3dd9c22c38",
      "name": "Datei-ID setzen",
      "type": "n8n-nodes-base.set",
      "position": [
        1232,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "79e9c100-c2d0-4fbd-97da-b2559a263eaa",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ed7a80c0-893d-41a5-b5c2-1b7ea5c6c64a",
      "name": "Aus Datei extrahieren",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2352,
        16
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1
    },
    {
      "id": "0f4833f8-ac06-4069-b935-d4c80fcaae97",
      "name": "Supabase Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        2576,
        16
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "queryName": "match_documents"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e5c920c4-06d4-4ed4-8ab7-e7271c7aa495",
      "name": "Standard-Datenlader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2624,
        304
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file_id",
                "value": "={{ $('Set File ID').item.json.file_id }}"
              }
            ]
          }
        },
        "jsonData": "={{ $json.data }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1
    },
    {
      "id": "15b7a747-6c48-4980-b9fe-342ef2695290",
      "name": "Rekursiver Zeichentext-Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        2624,
        512
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0bd90ef9-eadd-40ee-a355-679c25ea00b8",
      "name": "Datei erstellt",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        976,
        -96
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID_2",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_FOLDER_ID_2",
          "cachedResultName": "Your Second Watch Folder"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b7b355c9-f5b9-4284-8279-4ef65e9fafae",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2432,
        304
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "e9d25ee5-28f0-445d-9fff-4ddb0fdc253f",
      "name": "Über Elemente iterieren",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1472,
        16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4e46f442-6012-4144-924b-4987caee00f1",
      "name": "Zeile löschen",
      "type": "n8n-nodes-base.supabase",
      "position": [
        1776,
        -16
      ],
      "parameters": {
        "tableId": "documents",
        "operation": "delete",
        "filterType": "string",
        "filterString": "=metadata->>file_id=like.*{{ $json.file_id }}*"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "32a5b87c-2082-4784-8fda-9d2b216b9692",
      "name": "Datei herunterladen",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2096,
        -16
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID').item.json.file_id }}"
        },
        "options": {
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        },
        "operation": "download"
      },
      "typeVersion": 3
    },
    {
      "id": "ce5c5e25-7b29-43ca-ae6c-37478f7311b6",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        672
      ],
      "parameters": {
        "width": 1160,
        "height": 700,
        "content": "## Conversational RAG AI agent"
      },
      "typeVersion": 1
    },
    {
      "id": "cab8ef92-84f1-40b1-ab48-60be42f2af2a",
      "name": "Postgres-Chat-Speicher",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        1488,
        1056
      ],
      "parameters": {
        "sessionKey": "={{ $json.user}}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a7d2d794-0989-4cb3-bae7-8c3cd8efce94",
      "name": "OpenAI Chat-Modell",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1376,
        1056
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a43a8218-e3ff-41b3-aa7b-a2a77f565a74",
      "name": "Bei Chat-Nachricht empfangen",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1088,
        816
      ],
      "webhookId": "5ee7ed2e-2827-41c2-9dfc-5490a9a40825",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "d72474db-da71-4ae5-9fbc-ab575842a5e1",
      "name": "RAG-Vector-Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        1696,
        1008
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 6,
        "options": {
          "queryName": "match_documents"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        },
        "toolDescription": "Use this knowledge base to answer questions from the user",
        "includeDocumentMetadata": false
      },
      "typeVersion": 1.3
    },
    {
      "id": "af193ff9-dfce-423f-a7b6-28b4be9d3a50",
      "name": "RAG-KI-Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1392,
        816
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are an intelligent AI assistant connected to a dynamic knowledge base stored in a Supabase vector store. The information in this knowledge base can vary depending on the user and the data they have provided.\nInstructions:\nWhenever you receive a question, always search the knowledge base using the connected tool to retrieve relevant information before answering.\nIf a user asks what you can help with, or about your capabilities, query the knowledge base for a summary or list of available topics, documents, or areas of expertise.\nClearly mention that your abilities depend on the information currently available in the knowledge base, and provide specific examples or categories based on the retrieved data.\nIf the knowledge base is empty or does not contain relevant information, politely inform the user that you currently have no data to assist with their request.\nExample Behaviors:\nIf asked, \"What can you help me with?\"\n\n→ Search the knowledge base for available topics or documents and respond with a summary, e.g.,\n\n\"Based on the current knowledge base, I can assist you with topics such as [Topic A], [Topic B], and [Topic C]. Please let me know what you'd like to know more about!\"\nIf asked a specific question,\n\n→ Retrieve relevant information from the knowledge base and answer accordingly, citing the source or context if appropriate.\nIf the knowledge base is empty,\n\n→ \"I currently do not have any information in my knowledge base. Please add some data or let me know how I can assist you further.\"\nAlways ensure your responses are based on the most recent and relevant information from the knowledge base.\n"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6ce5b725-2692-4dee-8100-72fe32cfacd1",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1680,
        1168
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7502b182-44d3-4034-b44d-a50ba225cd07",
  "connections": {
    "0b1d7b3b-1840-4f82-b4e8-3f3dd9c22c38": {
      "main": [
        [
          {
            "node": "e9d25ee5-28f0-445d-9fff-4ddb0fdc253f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4e46f442-6012-4144-924b-4987caee00f1": {
      "main": [
        [
          {
            "node": "32a5b87c-2082-4784-8fda-9d2b216b9692",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0bd90ef9-eadd-40ee-a355-679c25ea00b8": {
      "main": [
        [
          {
            "node": "0b1d7b3b-1840-4f82-b4e8-3f3dd9c22c38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e833cbb0-3dde-4d15-bd0d-ee3d53b976c0": {
      "main": [
        [
          {
            "node": "0b1d7b3b-1840-4f82-b4e8-3f3dd9c22c38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e9d25ee5-28f0-445d-9fff-4ddb0fdc253f": {
      "main": [
        [],
        [
          {
            "node": "4e46f442-6012-4144-924b-4987caee00f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d72474db-da71-4ae5-9fbc-ab575842a5e1": {
      "ai_tool": [
        [
          {
            "node": "af193ff9-dfce-423f-a7b6-28b4be9d3a50",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "32a5b87c-2082-4784-8fda-9d2b216b9692": {
      "main": [
        [
          {
            "node": "ed7a80c0-893d-41a5-b5c2-1b7ea5c6c64a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b7b355c9-f5b9-4284-8279-4ef65e9fafae": {
      "ai_embedding": [
        [
          {
            "node": "0f4833f8-ac06-4069-b935-d4c80fcaae97",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "ed7a80c0-893d-41a5-b5c2-1b7ea5c6c64a": {
      "main": [
        [
          {
            "node": "0f4833f8-ac06-4069-b935-d4c80fcaae97",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a7d2d794-0989-4cb3-bae7-8c3cd8efce94": {
      "ai_languageModel": [
        [
          {
            "node": "af193ff9-dfce-423f-a7b6-28b4be9d3a50",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6ce5b725-2692-4dee-8100-72fe32cfacd1": {
      "ai_embedding": [
        [
          {
            "node": "d72474db-da71-4ae5-9fbc-ab575842a5e1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "e5c920c4-06d4-4ed4-8ab7-e7271c7aa495": {
      "ai_document": [
        [
          {
            "node": "0f4833f8-ac06-4069-b935-d4c80fcaae97",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "cab8ef92-84f1-40b1-ab48-60be42f2af2a": {
      "ai_memory": [
        [
          {
            "node": "af193ff9-dfce-423f-a7b6-28b4be9d3a50",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "0f4833f8-ac06-4069-b935-d4c80fcaae97": {
      "main": [
        [
          {
            "node": "e9d25ee5-28f0-445d-9fff-4ddb0fdc253f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a43a8218-e3ff-41b3-aa7b-a2a77f565a74": {
      "main": [
        [
          {
            "node": "af193ff9-dfce-423f-a7b6-28b4be9d3a50",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "15b7a747-6c48-4980-b9fe-342ef2695290": {
      "ai_textSplitter": [
        [
          {
            "node": "e5c920c4-06d4-4ed4-8ab7-e7271c7aa495",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Verschiedenes, KI RAG, Multimodales KI

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes20
Kategorie3
Node-Typen15
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
Babish Shrestha

Babish Shrestha

@bbz

I’m currently obsessed with building cool things using AI automation and AI agents — systems that save time, cut manual work, and actually do stuff on their own. If there’s a way to automate it, I’m probably already trying it out (or planning to). Having worked in IT industry for 15 years, I’m combining that background with AI to help businesses move smarter, not just faster.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34