{
  "name": "Build a RAG system by uploading PDFs to the Google Gemini File Search Store",
  "nodes": [
    {
      "id": "62bd25f1-61b6-473a-ad59-3642cb110ed0",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -384,
        -144
      ]
    },
    {
      "id": "e66227cc-73c9-42a8-9f73-da6c4139ef7d",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -400,
        240
      ]
    },
    {
      "id": "9aabf070-e13f-48be-af40-8e8bc5bb541d",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        80,
        224
      ]
    },
    {
      "id": "d693f266-3d04-4c5f-ba4b-c5e7b34c85fd",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -384,
        720
      ]
    },
    {
      "id": "ca48038f-4d02-4baf-a233-b80867a40bef",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        384,
        896
      ]
    },
    {
      "id": "a98fa97f-e25d-44a4-bc7c-45f7f91c9cab",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        80,
        704
      ]
    },
    {
      "id": "8e15d69d-2283-4320-b1e5-a22155d6ac2a",
      "name": "SearchStore",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        720,
        880
      ]
    },
    {
      "id": "15ad91ee-e9b0-42a7-a47a-3ae8bde1b1ac",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        544,
        896
      ]
    },
    {
      "id": "2346983a-5aba-4a96-97fe-00f9527871bb",
      "name": "Create Store",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        -144
      ]
    },
    {
      "id": "6896edef-1a7c-4f8d-ad76-407f8be20315",
      "name": "Upload File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        384,
        224
      ]
    },
    {
      "id": "3b42498a-c54e-4409-84a7-9ff57f386448",
      "name": "Import to Store",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        224
      ]
    },
    {
      "id": "00059810-17e5-41aa-9787-6fff626b182a",
      "name": "Get Store1",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        592
      ]
    },
    {
      "id": "29356ea0-043e-438a-acbf-99be816475f8",
      "name": "Rag Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        416,
        704
      ]
    },
    {
      "id": "c5c834de-6a73-4a23-9eef-cbc199ee23ad",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -176
      ],
      "parameters": {
        "width": 512,
        "height": 208,
        "content": "```json\n[\n  {\n    \"name\": \"fileSearchStores/my-store-XXXXX\",\n    \"displayName\": \"My Store\",\n    \"createTime\": \"2025-11-22T16:33:57.084623Z\",\n    \"updateTime\": \"2025-11-22T16:33:57.084623Z\"\n  }\n]\n```"
      }
    },
    {
      "id": "42c59588-e8a2-4265-a49c-ff982c8e00e5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -288
      ],
      "parameters": {
        "width": 1024,
        "height": 352,
        "content": "## STEP 1 - Create a new Search Store\nTriggered manually via the *“Execute workflow”* node, this step sends a request to the Gemini API to create a **FileSearch Store**, which acts as a private vector"
      }
    },
    {
      "id": "c998f2ea-1721-482a-91ed-bb67cbb06359",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        80
      ],
      "parameters": {
        "width": 512,
        "height": 352,
        "content": "## STEP 2 - Upload a new file to Search Store\nUpload and import a file into the Search Store"
      }
    },
    {
      "id": "c96e1b19-2108-4a6b-a78f-b15bb540e97a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        448
      ],
      "parameters": {
        "width": 512,
        "height": 592,
        "content": "## STEP 3 - Retrieved Context from Search Store\n\nWhen a chat message is received:\n\n* The workflow loads the Search Store identifier.\n* A *LangChain Agent* is used along with the **Google Gemini Chat M"
      }
    },
    {
      "id": "72071705-f8e2-4919-a156-742b6a9bbd8a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        80
      ],
      "parameters": {
        "width": 208,
        "height": 960,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSet the Search Store created in STEP 1 (eg. fileSearchStores/my-store-XXXXX)"
      }
    },
    {
      "id": "7128fcb3-49b8-41ca-bab3-17942a5042b8",
      "name": "Get Store",
      "type": "n8n-nodes-base.set",
      "position": [
        -144,
        144
      ]
    },
    {
      "id": "0fd1dfbe-fd89-412a-9464-a390dc52caf2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -832
      ],
      "parameters": {
        "width": 1024,
        "height": 496,
        "content": "## RAG with Google Gemini Search Store\n\nThis workflow implements a Retrieval-Augmented Generation (RAG) system using Google Gemini’s File Search API. It allows users to upload files to a dedicated sea"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Upload File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Rag Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Store": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Store1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SearchStore": {
      "ai_tool": [
        [
          {
            "node": "Rag Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Upload File": {
      "main": [
        [
          {
            "node": "Import to Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Rag Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Get Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Rag Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Get Store1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Create Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}