Chatbot RAG avec Google Drive

Avancé

Ceci est unMiscellaneous, AI RAG, Multimodal AIworkflow d'automatisation du domainecontenant 20 nœuds.Utilise principalement des nœuds comme Set, Supabase, GoogleDrive, SplitInBatches, Agent. Construire un chatbot de connaissances RAG avec OpenAI, Google Drive et Supabase

Prérequis
  • URL et Clé API Supabase
  • Informations d'identification Google Drive API
  • Clé API OpenAI
  • Informations de connexion à la base de données PostgreSQL
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "6naAx0wcjHZbs2pM",
  "meta": {
    "instanceId": "d4f16bea1a8eb4bd7217a4d0fe9a09f643e7227b28772e65da5a86a149783124",
    "templateCredsSetupCompleted": true
  },
  "name": "RAG chatbot using Google Drive",
  "tags": [],
  "nodes": [
    {
      "id": "4191c842-b484-467e-bea5-d2ff44af79e0",
      "name": "Guide d'installation complet",
      "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": "Note autocollante1",
      "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": "Fichier mis à jour",
      "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": "Définir l'ID du fichier",
      "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": "Extraire du fichier",
      "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": "Chargeur de données par défaut",
      "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": "Séparateur de texte récursif",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        2624,
        512
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0bd90ef9-eadd-40ee-a355-679c25ea00b8",
      "name": "Fichier créé",
      "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": "Boucle sur les éléments",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1472,
        16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4e46f442-6012-4144-924b-4987caee00f1",
      "name": "Supprimer une ligne",
      "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": "Télécharger le fichier",
      "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": "Note autocollante",
      "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": "Mémoire de chat Postgres",
      "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 Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1376,
        1056
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a43a8218-e3ff-41b3-aa7b-a2a77f565a74",
      "name": "À la réception d'un message de chat",
      "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": "Agent IA RAG",
      "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
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Divers, RAG IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds20
Catégorie3
Types de nœuds15
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
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.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34