{
  "name": "Build a PDF Document RAG System with Mistral OCR, Qdrant and Gemini AI",
  "nodes": [
    {
      "id": "01a1b5b8-353f-4bfe-8bd0-c5dff1214c86",
      "name": "Mistral Upload",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        180,
        520
      ]
    },
    {
      "id": "45267068-bdbc-45d3-bfe9-354cad73285b",
      "name": "Mistral Signed URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        520
      ]
    },
    {
      "id": "61416fe4-d5d9-4417-9142-461dd6a45fa4",
      "name": "Mistral DOC OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        820,
        520
      ]
    },
    {
      "id": "c45ea050-c65b-48b2-b817-d651c3a0de8a",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -480,
        -300
      ]
    },
    {
      "id": "db931c73-916e-48ce-af17-cd5ab2e7c64d",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1540,
        520
      ]
    },
    {
      "id": "76daea49-34f2-4567-8547-4b3d89ce921c",
      "name": "Refresh collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -140,
        -300
      ]
    },
    {
      "id": "ac7c469e-d0e8-4146-b323-f3948c3331fa",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2320,
        800
      ]
    },
    {
      "id": "67591961-ef29-4bef-9905-8be18d5e9814",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2460,
        760
      ]
    },
    {
      "id": "54c38164-6492-42d6-8b44-e10bbfdcd807",
      "name": "Token Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        2560,
        940
      ]
    },
    {
      "id": "661137fc-7afa-49a8-900c-a8c7fd63f557",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -480,
        960
      ]
    },
    {
      "id": "fe971655-b323-4ccf-a6c5-764d7cc3d8bc",
      "name": "Question and Answer Chain",
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "position": [
        -160,
        960
      ]
    },
    {
      "id": "8806cf11-83e8-4c75-ba96-71a62d1fb632",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -220,
        1160
      ]
    },
    {
      "id": "8012569d-5e29-4f36-89be-394ac4928194",
      "name": "Vector Store Retriever",
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "position": [
        0,
        1180
      ]
    },
    {
      "id": "f33e13dd-2465-4971-bcbf-d2d9461f5453",
      "name": "Qdrant Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        20,
        1380
      ]
    },
    {
      "id": "f864b8c1-8b4f-4116-812a-843aea0347ac",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -100,
        1520
      ]
    },
    {
      "id": "48799279-d580-4c3f-ab39-e2da1bf1d577",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1140,
        520
      ]
    },
    {
      "id": "5c68cd54-3841-46e0-9b2e-05a1188e92c0",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2860,
        540
      ]
    },
    {
      "id": "0853153e-33a3-44a8-ab22-c296b7aab892",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        2380,
        540
      ]
    },
    {
      "id": "4123fa10-ec36-40cd-ad85-b8353479db28",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        540,
        -300
      ]
    },
    {
      "id": "16fadeb2-5612-421e-8da3-37bed966d966",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1160,
        -280
      ]
    },
    {
      "id": "0f61b1ab-45a3-4167-a4f1-baeca03109bd",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -460,
        520
      ]
    },
    {
      "id": "034fc82c-b13a-4e72-ae86-97676d5b8867",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        860,
        -280
      ]
    },
    {
      "id": "0c5d144c-77de-4d3b-a30b-3674ea858f3e",
      "name": "Create collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -480,
        -760
      ]
    },
    {
      "id": "5dab4a20-0daa-43f2-8878-eae8720aa50f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -820
      ],
      "parameters": {
        "width": 880,
        "height": 220,
        "content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "b78c160a-0e73-4fa0-9015-d8b2a249fd33",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -400
      ],
      "parameters": {
        "width": 620,
        "height": 520,
        "content": "# STEP 2\n\n\n\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": "8988f19e-259b-4e01-833a-f8ed2f89c7d6",
      "name": "Summarization Chain",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        1820,
        140
      ]
    },
    {
      "id": "b7581380-5431-42f1-b4de-279faf4bdf16",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1840,
        320
      ]
    },
    {
      "id": "037896c0-7561-4ca1-9130-adc1175408b5",
      "name": "Set page",
      "type": "n8n-nodes-base.set",
      "position": [
        2000,
        540
      ]
    },
    {
      "id": "06444ac1-382a-41df-8ff7-a1a5fea9e6ec",
      "name": "Set summary",
      "type": "n8n-nodes-base.set",
      "position": [
        2180,
        140
      ]
    },
    {
      "id": "00bd51e2-a969-415a-9fca-f67bf9df96dc",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        20
      ],
      "parameters": {
        "width": 600,
        "height": 680,
        "content": "## STEP 3\nIf you want a \"light\" and faster rag with the main contents replace the \"Set page\" node with \"Summarization Chain\""
      }
    },
    {
      "id": "da71f8f9-bff9-48e1-b2e4-9fbbe7ac8924",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        960
      ],
      "parameters": {
        "width": 500,
        "height": 120,
        "content": "## STEP 4\nTest the RAG"
      }
    },
    {
      "id": "b0c57120-6b07-4823-9341-c3f42ca313f5",
      "name": "Search PDFs",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        200,
        -300
      ]
    },
    {
      "id": "26990fbc-3315-42d5-948d-3b670e7d4f84",
      "name": "Get PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -140,
        520
      ]
    },
    {
      "id": "013e49fe-7ee2-4d24-b640-dda63fa034b3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -1080
      ],
      "parameters": {
        "width": 1140,
        "height": 140,
        "content": "## Complete RAG system from PDF Documents with Mistral OCR, Qdrant and Gemini AI\n\nThis workflow is designed to process PDF documents using Mistral's OCR capabilities, store the extracted text in a Qdr"
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get PDF": {
      "main": [
        [
          {
            "node": "Mistral Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set page": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search PDFs": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload": {
      "main": [
        [
          {
            "node": "Mistral Signed URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Set page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral DOC OCR": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh collection": {
      "main": [
        [
          {
            "node": "Search PDFs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarization Chain": {
      "main": [
        [
          {
            "node": "Set summary",
            "type": "main",
            "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
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Summarization Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Get PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Refresh collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}