{
  "name": "Document RAG & chat agent: Google Drive to Qdrant with Mistral OCR",
  "nodes": [
    {
      "id": "7935a827-516b-4e64-b370-f17d23c70857",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1488,
        432
      ]
    },
    {
      "id": "32429618-1bed-4134-953f-fa5f0eed6981",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        528,
        432
      ]
    },
    {
      "id": "c770feb0-c01a-4e94-832a-3dafc88fb28f",
      "name": "Web Search ",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1200,
        480
      ]
    },
    {
      "id": "5b31d3c8-3fe5-4cfd-bb09-81193e6d973f",
      "name": "Simple Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        688,
        432
      ]
    },
    {
      "id": "42ff3014-5b83-474f-a35c-5384828b49fd",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1488,
        304
      ]
    },
    {
      "id": "c405636b-4957-4de1-9cd4-8733647af3a9",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        496,
        112
      ]
    },
    {
      "id": "8f2950f4-0c96-4d70-9aa0-2729dd0b560e",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        3344,
        1328
      ]
    },
    {
      "id": "b008bae1-bc63-47da-8afa-b8a1b17ea412",
      "name": "Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "position": [
        3408,
        1440
      ]
    },
    {
      "id": "fb42d3ab-5c20-4efc-920a-87dc96890cab",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        368,
        1136
      ]
    },
    {
      "id": "393465a4-4b14-42ef-b2ca-608a161c6914",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1088,
        1152
      ]
    },
    {
      "id": "3e38082e-4619-47cf-98e0-f7f66a8541c1",
      "name": "Mistral Upload",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        1152
      ]
    },
    {
      "id": "255683ca-712a-4386-ae19-b3fbb5f37e30",
      "name": "Mistral Signed URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1552,
        1152
      ]
    },
    {
      "id": "2e846e38-ae17-4717-a39b-b3d0e0c567f9",
      "name": "Mistral DOC OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1776,
        1152
      ]
    },
    {
      "id": "a1c139ec-5ec2-4142-aacc-5df387b677fd",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        96,
        1136
      ]
    },
    {
      "id": "6ceb4cbc-b4b0-4ac6-befe-a92649279bf4",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        3168,
        1456
      ]
    },
    {
      "id": "ee2ce006-d94c-49a7-849f-8155c95ee118",
      "name": "Qdrant Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        3184,
        1152
      ]
    },
    {
      "id": "b4a1a6a6-6f2e-4ac6-8fba-f5752ac66259",
      "name": "Mistral Cloud Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        2208,
        1456
      ]
    },
    {
      "id": "85a90fcf-b75c-4ecc-90e2-611c8db61073",
      "name": "ai chat agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        992,
        112
      ]
    },
    {
      "id": "3e71d64a-3a04-4f5e-b009-8eddbef94e8c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        416
      ],
      "parameters": {
        "width": 400,
        "height": 208,
        "content": "## WEB SEARCH using tavily (http node)\n [Tavily setup Guide](https://docs.tavily.com/welcome)"
      }
    },
    {
      "id": "3c335f41-3d05-4436-ad0f-ce6957967a0c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        928
      ],
      "parameters": {
        "width": 224,
        "height": 400,
        "content": "## GET ALL FILE DATA FROM SELECTED GOOGLE DRIVE FOLDER"
      }
    },
    {
      "id": "a404df40-0f40-46b5-a65b-edc182d06d9b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        1040
      ],
      "parameters": {
        "width": 192,
        "height": 256,
        "content": "## Remove  empty data fields  "
      }
    },
    {
      "id": "4776e7ea-7243-474f-9ec0-47afc46d8479",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        976
      ],
      "parameters": {
        "width": 208,
        "height": 320,
        "content": "## GET  individual files from selected gdrive"
      }
    },
    {
      "id": "3a593a87-2d91-48dc-85da-98a5bc562ff6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        1008
      ],
      "parameters": {
        "width": 608,
        "height": 272,
        "content": "## MISTRAL OCR\n [OCR Guide](https://mistral.ai/news/mistral-ocr)\n1. UPLOAD FILE\n2. GET SIGNED URL\n3. GET EXTRACT DATA AFTER USING MISTRAL OCR"
      }
    },
    {
      "id": "65106e47-a303-4f46-be3b-207d6e6c04fa",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        16
      ],
      "parameters": {
        "width": 368,
        "height": 288,
        "content": "## Hosted Chat interface  \n"
      }
    },
    {
      "id": "78103cfe-e101-4d70-8dea-08b4ca2bbdb6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        96
      ],
      "parameters": {
        "width": 272,
        "height": 496,
        "content": "## QDRANT VCETOR AND OPEN API EMBEDDING \n [QDRANT Guide](https://qdrant.tech/documentation/)"
      }
    },
    {
      "id": "716859d0-f3eb-431c-a6fc-37301508c968",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        0
      ],
      "parameters": {
        "width": 432,
        "height": 304,
        "content": "## AI chat agent\n interact with user and process user input and provide appropriate response using different tools. "
      }
    },
    {
      "id": "aa7c86ee-3229-415e-96eb-92fbd530aa44",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2672,
        1008
      ],
      "parameters": {
        "width": 320,
        "height": 288,
        "content": "## clean all extracted data and convert them to smaller chunks"
      }
    },
    {
      "id": "ccd381e0-1cd2-406d-9aec-7b03c18ee435",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2176,
        928
      ],
      "parameters": {
        "width": 288,
        "height": 368,
        "content": "## assignment agent\n\nfor any given file this node assign which type documents it is ,which project its related too and who are working on it"
      }
    },
    {
      "id": "87f7a493-d65c-447b-a465-3175c1bcbea7",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3088,
        976
      ],
      "parameters": {
        "width": 512,
        "height": 608,
        "content": "## load all chunks into qdrant vector database"
      }
    },
    {
      "id": "66f3dfcf-9fbe-4d63-888e-dda7c422c282",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        992
      ],
      "parameters": {
        "width": 256,
        "height": 320,
        "content": "## loop over google drive folder items"
      }
    },
    {
      "id": "d21fe18b-7f9b-46b5-a8b5-2725c849db7f",
      "name": "Loop Over each file in gdrive folder",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        608,
        1136
      ]
    },
    {
      "id": "4300ad47-a92a-408b-aa8b-b56249d341e9",
      "name": "add metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        896,
        1152
      ]
    },
    {
      "id": "efc3f354-0a6d-46dc-8ecf-793873e19466",
      "name": "If NODE",
      "type": "n8n-nodes-base.if",
      "position": [
        1984,
        1152
      ]
    },
    {
      "id": "33e574c3-47a2-454b-85e9-e3e9983e3d63",
      "name": "based file name it assign differ metadata",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        2208,
        1152
      ]
    },
    {
      "id": "c4b2a5cb-b849-4d7e-9f24-7ef67ee4031a",
      "name": "set all metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        2512,
        1152
      ]
    },
    {
      "id": "2a4026cf-3034-49a8-8dc8-ad67ae571213",
      "name": "clean output",
      "type": "n8n-nodes-base.code",
      "position": [
        2704,
        1152
      ]
    },
    {
      "id": "f9172d1d-060c-46f7-8e48-b235a2610185",
      "name": "convert data into smaller chunks",
      "type": "n8n-nodes-base.code",
      "position": [
        2864,
        1152
      ]
    },
    {
      "id": "2a9539e7-e8dc-4c2a-a016-daab8c7d5339",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3696,
        736
      ],
      "parameters": {
        "width": 800,
        "height": 1248,
        "content": "### **Node List & Descriptions**\n\n1. **Manual Trigger**  \n   - **What:** Kicks off the workflow when the user clicks **“Test workflow.”**  \n   - **Why:** Allows for on-demand execution and testing of "
      }
    },
    {
      "id": "83726285-3bfd-4d22-ad35-39a5ff3ef414",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -176
      ],
      "parameters": {
        "width": 864,
        "height": 1856,
        "content": "# Konowledge RAG and AI chat agent  \n## by DIGITAL BIZ TECH\n\n## **Overview**\n\nThis workflow automates the process of transforming all files stored in Google Drive into a **searchable, intelligent know"
      }
    }
  ],
  "connections": {
    "If NODE": {
      "main": [
        [
          {
            "node": "based file name it assign differ metadata",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over each file in gdrive folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Web Search ": {
      "ai_tool": [
        [
          {
            "node": "ai chat agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Loop Over each file in gdrive folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "add metadata": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "clean output": {
      "main": [
        [
          {
            "node": "convert data into smaller chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive1": {
      "main": [
        [
          {
            "node": "Mistral Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload": {
      "main": [
        [
          {
            "node": "Mistral Signed URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "ai chat agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Mistral DOC OCR": {
      "main": [
        [
          {
            "node": "If NODE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set all metadata": {
      "main": [
        [
          {
            "node": "clean output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "ai chat agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_tool": [
        [
          {
            "node": "ai chat agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store1": {
      "main": [
        [
          {
            "node": "Loop Over each file in gdrive folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "based file name it assign differ metadata",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "ai chat agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "convert data into smaller chunks": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over each file in gdrive folder": {
      "main": [
        [],
        [
          {
            "node": "add metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "based file name it assign differ metadata": {
      "main": [
        [
          {
            "node": "set all metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}