{
  "name": "Document Q&A system with OpenAI GPT, Pinecone Vector DB & Google Drive integration",
  "nodes": [
    {
      "id": "784badb8-0cf6-434d-9d5d-1670757b548b",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -300,
        -40
      ]
    },
    {
      "id": "26b93e8c-0a72-4491-90fe-55b5f5da02a0",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -80,
        -40
      ]
    },
    {
      "id": "21174f84-5f7b-45bc-944b-0f0a7c2ffd49",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        140,
        -40
      ]
    },
    {
      "id": "d84e6051-cc04-4f51-b9c3-0e69e2193571",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        360,
        -40
      ]
    },
    {
      "id": "3185a781-28af-4ee0-be7b-2183b80ce0e3",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        300,
        160
      ]
    },
    {
      "id": "8eccc3bb-654f-4a92-8074-9d2418afae12",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        500,
        180
      ]
    },
    {
      "id": "9a6a4542-81f0-4fa6-b0fa-6fbfcf5fb3d3",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        600,
        400
      ]
    },
    {
      "id": "60485603-13aa-46c8-9824-011b75d368bd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        -180
      ],
      "parameters": {
        "width": 1300,
        "height": 980,
        "content": "## Document Loading \n1. Connect to Google Drive folder to access Contract Agreement Documents\n2. Download and Vectorize the Data using Vector Embedding \n3. Store in Pinecone Database"
      }
    },
    {
      "id": "349466bc-c0c7-4e4e-9e9c-78554a3123ae",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        940
      ],
      "parameters": {
        "width": 1300,
        "height": 720,
        "content": "## Query Document via Chat (for testing)"
      }
    },
    {
      "id": "id",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -100,
        980
      ]
    },
    {
      "id": "4240e62e-0b44-4dbd-9cff-87a404a496bd",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        120,
        980
      ]
    },
    {
      "id": "34d9e834-3aba-4c80-8c4d-4206fcdbfac3",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        80,
        1200
      ]
    },
    {
      "id": "784924f6-d197-4666-9a05-e36020021ae2",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        200,
        1200
      ]
    },
    {
      "id": "00b70c8d-5940-4eef-84c4-b87d69df3ab9",
      "name": "Answer questions with a vector store",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        380,
        1200
      ]
    },
    {
      "id": "dfefbee7-5125-42da-b696-f343dc89573c",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        180,
        1360
      ]
    },
    {
      "id": "8a0e2476-661e-4702-8563-ec0b12033884",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        200,
        1500
      ]
    },
    {
      "id": "31a4456c-4a35-4beb-9c4b-de49e460e492",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        520,
        1420
      ]
    },
    {
      "id": "7aa47a91-19f9-4a0e-b1b2-5867cf4982ef",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1660,
        -160
      ],
      "parameters": {
        "width": 1200,
        "height": 980,
        "content": "## Query document from a user interface connectied via Webhook\n"
      }
    },
    {
      "id": "c9da6a17-a0aa-4d3c-844a-1c3785a956eb",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1900,
        0
      ]
    },
    {
      "id": "b1e8830f-8cfe-40ef-b611-76e70cd9184b",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2120,
        0
      ]
    },
    {
      "id": "87db20d4-7a7c-48a6-a29a-2fd089f93a43",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2020,
        220
      ]
    },
    {
      "id": "2454b5ff-e53e-41c5-9844-f171d63ee2d4",
      "name": "Simple Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2180,
        220
      ]
    },
    {
      "id": "e33b7eff-0166-43b2-ab7e-5f53063164a9",
      "name": "Answer questions with a vector store1",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        2380,
        220
      ]
    },
    {
      "id": "e223bcf1-7085-433a-a51d-708b0c36a2e4",
      "name": "Pinecone Vector Store2",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        2180,
        380
      ]
    },
    {
      "id": "9e3f06a1-900b-427e-8775-dad8ddc1de80",
      "name": "Embeddings OpenAI2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2200,
        520
      ]
    },
    {
      "id": "df06efec-1f75-4309-923b-044e1c1991f3",
      "name": "OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2520,
        440
      ]
    },
    {
      "id": "01b59805-abdd-49ff-a553-0dddf3ed1450",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2480,
        0
      ]
    },
    {
      "id": "05fd0853-0ebd-4a99-9345-982c9e664e27",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -180
      ],
      "parameters": {
        "width": 560,
        "height": 980,
        "content": "This project demonstrates how to build a Retrieval-Augmented Generation (RAG) system using n8n, which:\n🧾 Downloads any pdf file format documents from Google Drive\n📚 Converts them into vector embedding"
      }
    },
    {
      "id": "7f1cc5b2-104e-4571-a838-29c71c79bd08",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        940
      ],
      "parameters": {
        "width": 560,
        "height": 720,
        "content": "## Quyerying the Documetn via Chat \nThis flow enables chat-style querying of stored documents using OpenAI-powered agents with vector memory.\n\n### 🧱 Workflow Diagram\n  A[Webhook (chat message)] --> B["
      }
    },
    {
      "id": "e11b8fbd-c24b-469f-a196-1e507a6d3e75",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -160
      ],
      "parameters": {
        "width": 560,
        "height": 980,
        "content": "## 🌐 Flow 3: UI-Based Query with webhook connecting to Lovable\nThis flow uses a web UI built using Lovable to query contracts directly from a form interface.\n\n### 📥 Webhook Setup for Lovable\nWebhook N"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive1": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI2": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store2": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store1",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}