{
  "name": "Build a self-updating RAG system with OpenAI, Qdrant and Google Drive",
  "nodes": [
    {
      "id": "40fb5a5b-cd99-4f4c-9a10-28bbb6bb56c4",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        32,
        496
      ]
    },
    {
      "id": "a86c5bdc-036e-4122-a4a8-24d831d72559",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1424,
        896
      ]
    },
    {
      "id": "f7e9543c-1d4c-4e5a-bc5e-ba528f5c59c7",
      "name": "Default Data Loader1",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1568,
        896
      ]
    },
    {
      "id": "38e08de0-2fc6-4a5e-a0c7-77388c979c65",
      "name": "Create collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        336,
        368
      ]
    },
    {
      "id": "49bfc3c7-b697-4dfe-bfec-e1c7e681745a",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1568,
        1088
      ]
    },
    {
      "id": "bf6b734b-6918-4a85-bdbd-272180be0574",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        912,
        640
      ]
    },
    {
      "id": "fa9378dd-5c45-459f-b859-3788bf4d44fc",
      "name": "Embeddings OpenAI2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        992,
        1840
      ]
    },
    {
      "id": "c74ef2e9-3b29-4e75-87a4-4c8997d4ed63",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1120,
        1840
      ]
    },
    {
      "id": "930d03e9-15e2-42ef-aa32-c7bd611abfb9",
      "name": "Recursive Character Text Splitter1",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1104,
        2048
      ]
    },
    {
      "id": "fbbc9557-88fb-4051-a15a-8d0a4155ebc7",
      "name": "Set file_id",
      "type": "n8n-nodes-base.set",
      "position": [
        384,
        1296
      ]
    },
    {
      "id": "d9fcd8ee-9580-4e0d-aa01-a973d4a28755",
      "name": "Clear collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        336,
        640
      ]
    },
    {
      "id": "c2850362-f822-4a42-9bce-0e3719a0cb4c",
      "name": "Delete points by file_id",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        784,
        1184
      ]
    },
    {
      "id": "7d3398ca-a2f8-4f2e-8b70-fdc6d4c58cc0",
      "name": "Search files",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        608,
        640
      ]
    },
    {
      "id": "f6b8f801-4079-4a47-9d9f-2beb3ffd8f18",
      "name": "Wait 5 sec.",
      "type": "n8n-nodes-base.wait",
      "position": [
        1872,
        656
      ]
    },
    {
      "id": "d2925096-3c92-41cb-ab22-eeb8a0b3d5bc",
      "name": "Update file",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1024,
        1648
      ]
    },
    {
      "id": "6b53ea53-3fb2-4049-acbb-2c90e5e679ce",
      "name": "Insert file",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1488,
        656
      ]
    },
    {
      "id": "6019beec-0f0a-4767-a1d4-048a7763bf21",
      "name": "Get file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        784,
        1648
      ]
    },
    {
      "id": "ee9f2b69-b28e-4c77-bbac-7a4c62748132",
      "name": "Get files",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1184,
        656
      ]
    },
    {
      "id": "21fdbbf6-2643-4918-8adb-8f57ee5e194e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 840,
        "height": 220,
        "content": "## Complete RAG System with autoUpdate documents Using Qdrant\n\nThis workflow implements a **Retrieval-Augmented Generation (RAG)** system that:\n\n* Stores vectorized documents in **Qdrant**,\n* Retrieve"
      }
    },
    {
      "id": "a3c10de1-7559-4bf9-951b-0ccad7cf62c5",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        96,
        2400
      ]
    },
    {
      "id": "3e295eb8-7b41-4f9c-9489-5097442c9a00",
      "name": "Question and Answer Chain",
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "position": [
        416,
        2400
      ]
    },
    {
      "id": "43e4676f-ee0a-444c-9bed-0271a3392a19",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        304,
        2640
      ]
    },
    {
      "id": "deba1a75-e1f3-4830-95f0-2f29503d5ab8",
      "name": "Vector Store Retriever",
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "position": [
        544,
        2688
      ]
    },
    {
      "id": "eb2859b7-7c69-4376-a183-aa18cfd2ff34",
      "name": "Qdrant Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        416,
        2896
      ]
    },
    {
      "id": "030a0e51-8d06-422e-bb8a-38805c2bf6e0",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        416,
        3088
      ]
    },
    {
      "id": "f2659705-08a2-401c-b157-fe9fcb6ac41d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1888,
        896
      ],
      "parameters": {
        "width": 520,
        "height": 420,
        "content": "Set as metadata:\n- FILE_ID from Google Drive\n- FILE_NAME from Google Drive\n\n```\n{\n  \"source\": \"blob\",\n  \"blobType\": \"text/plain\",\n  \"loc\": {\n    \"lines\": {\n      \"from\": 1,\n      \"to\": 15\n    }\n  },\n "
      }
    },
    {
      "id": "9af3ccb4-3056-496b-9cf1-9d40812c8356",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        560
      ],
      "parameters": {
        "width": 540,
        "height": 460,
        "content": "# STEP 2\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "b8eddec7-7228-4c2d-9fe0-eddc86018fa9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        288
      ],
      "parameters": {
        "width": 880,
        "height": 220,
        "content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "916c4619-3212-4027-87d5-832892e9db6e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        1808
      ],
      "parameters": {
        "width": 520,
        "height": 420,
        "content": "Set as metadata:\n- FILE_ID from Google Drive\n- FILE_NAME from Google Drive\n\n```\n{\n  \"source\": \"blob\",\n  \"blobType\": \"text/plain\",\n  \"loc\": {\n    \"lines\": {\n      \"from\": 1,\n      \"to\": 15\n    }\n  },\n "
      }
    },
    {
      "id": "a9cb8a81-b021-4a85-b0bd-0c60e0e2987c",
      "name": "Update?",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        64,
        1296
      ]
    },
    {
      "id": "dde138e9-7a07-4913-97d0-9f9106c9f1f2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        1104
      ],
      "parameters": {
        "width": 400,
        "height": 440,
        "content": "# STEP 3\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "f438eace-d66c-4835-90d0-ac39e97ece38",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        2240
      ],
      "parameters": {
        "width": 580,
        "height": 120,
        "content": "# STEP 4\n\nTry RAG"
      }
    },
    {
      "id": "67fb6630-abdc-431e-8073-9fbd700a9d20",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        0
      ],
      "parameters": {
        "width": 736,
        "height": 736,
        "content": "## MY NEW YOUTUBE CHANNEL\n👉 [Subscribe to my new **YouTube channel**](https://youtube.com/@n3witalia). Here I’ll share videos and Shorts with practical tutorials and **FREE templates for n8n**.\n\n[![im"
      }
    }
  ],
  "connections": {
    "Update?": {
      "main": [
        [
          {
            "node": "Set file_id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file": {
      "main": [
        [
          {
            "node": "Update file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get files": {
      "main": [
        [
          {
            "node": "Insert file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert file": {
      "main": [
        [
          {
            "node": "Wait 5 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set file_id": {
      "main": [
        [
          {
            "node": "Delete points by file_id",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 sec.": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Get files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear collection": {
      "main": [
        [
          {
            "node": "Search files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Insert file",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI2": {
      "ai_embedding": [
        [
          {
            "node": "Update file",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Update file",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader1": {
      "ai_document": [
        [
          {
            "node": "Insert file",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Retriever",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Retriever": {
      "ai_retriever": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_retriever",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader1",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Create collection",
            "type": "main",
            "index": 0
          },
          {
            "node": "Clear collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter1": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}