AutomationFlowsAI & RAG › RAG Vector Workflow with Google Drive & OpenAI

RAG Vector Workflow with Google Drive & OpenAI

Original n8n title: Use Vectors in RAG

Use Vectors in RAG. Uses googleDrive, documentDefaultDataLoader, textSplitterCharacterTextSplitter, embeddingsOpenAi. Event-driven trigger; 17 nodes.

Event trigger★★★★☆ complexityAI-powered17 nodesGoogle DriveDocument Default Data LoaderText Splitter Character Text SplitterOpenAI EmbeddingsMySQLMemory Buffer WindowOpenAI ChatTool Vector Store
AI & RAG Trigger: Event Nodes: 17 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Use Vectors in RAG",
  "nodes": [
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "https://docs.google.com/document/d/1pR-KsKsbadO7QP_NS2p1CMl0ZjQ7A6bk72oS5-hnRWs/edit?usp=sharing",
          "mode": "url"
        },
        "options": {
          "binaryPropertyName": "data",
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        }
      },
      "id": "9107ce7d-7cb1-4277-8faa-6989febe1db1",
      "name": "Get File Content",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        360,
        1680
      ],
      "executeOnce": true,
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $json.data }}",
        "options": {}
      },
      "id": "ea756af3-65d8-4843-8777-6ecd1d89796f",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        780,
        1840
      ]
    },
    {
      "parameters": {
        "chunkSize": 500,
        "chunkOverlap": 100
      },
      "id": "fa7bfedd-1c6b-4ad2-84e2-8ab01fe37b1a",
      "name": "Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        820,
        1980
      ]
    },
    {
      "parameters": {
        "operation": "text",
        "options": {}
      },
      "id": "ee24a79a-c26f-49cd-b65a-250625b4650d",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        500,
        1680
      ]
    },
    {
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {}
      },
      "id": "84c2f76e-48cc-4260-a89f-d0d3f97c7a2c",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1,
      "position": [
        600,
        1880
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "id": "704d3a69-e4c6-4e04-9628-7c5c26c0af2c",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        200,
        1680
      ]
    },
    {
      "parameters": {
        "table": {
          "__rl": true,
          "value": "Carnot",
          "mode": "list",
          "cachedResultName": "Carnot"
        },
        "dataMode": "defineBelow",
        "valuesToSend": {
          "values": [
            {
              "column": "pageContent",
              "value": "={{ $json.pageContent }}"
            }
          ]
        },
        "options": {}
      },
      "id": "3d1dc074-ad37-4975-a954-74bd0be1fd85",
      "name": "MySQL",
      "type": "n8n-nodes-base.mySql",
      "typeVersion": 2.4,
      "position": [
        1040,
        1680
      ],
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "id": "9f600a58-189c-46d1-9e5b-c78ade8a8538",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.2,
      "position": [
        360,
        1520
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "3548a1c9-1b81-41b2-b256-002e1b702a3a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        180,
        1500
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "name": "user_documents",
        "description": "Contains all the user's documents that you can check for context to answer user questions."
      },
      "id": "75a81214-0ee8-41b5-8cbf-bb06d3fa1c97",
      "name": "Retrieve Documents",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1,
      "position": [
        740,
        1280
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "73df9a0f-d771-439d-9edd-2bbec4f00dcd",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        860,
        1520
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {}
      },
      "id": "2ff5658e-4eb2-44b4-94f4-1e056a4df869",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1,
      "position": [
        680,
        1540
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "a9d804ae-3435-4a9e-b28f-aab55e5ccde6",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        40,
        1300
      ]
    },
    {
      "parameters": {
        "memoryKey": "user_documents"
      },
      "id": "cc644b24-f245-4cc5-9e86-86298dc1f8d2",
      "name": "In-Memory Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1,
      "position": [
        600,
        1420
      ]
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": "=user_documents",
        "clearStore": true
      },
      "id": "81636bfe-295e-4cbf-b6ec-401365cc938d",
      "name": "In-Memory Vector Store Inserter",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1,
      "position": [
        640,
        1680
      ]
    },
    {
      "parameters": {
        "content": "Blank:\nhttps://docs.google.com/document/d/1A4Kq3gmTb9skuQ21dJuR67jfkowGaZQAFaQ1urH0-Mk/edit?usp=sharing\n\nMCC and Carnot:\nhttps://docs.google.com/document/d/1pR-KsKsbadO7QP_NS2p1CMl0ZjQ7A6bk72oS5-hnRWs/edit?usp=sharing",
        "height": 193.48837209302337,
        "width": 380.33222591362124
      },
      "id": "98cdf086-cea9-4782-8874-123bd43f24c8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -20,
        1960
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "9a99b3c9-ff5d-44e7-9595-37f2938e7965",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        240,
        1300
      ]
    }
  ],
  "connections": {
    "Get File Content": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "In-Memory Vector Store Inserter",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "In-Memory Vector Store Inserter",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Get File Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "In-Memory Vector Store Inserter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Documents": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Retrieve Documents",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "In-Memory Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "In-Memory Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Retrieve Documents",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "In-Memory Vector Store Inserter": {
      "main": [
        [
          {
            "node": "MySQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "41f31eb3-f8a7-4e90-ad99-6f3f93a84d37",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "YhVAqTWf0SmZALIk",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Use Vectors in RAG. Uses googleDrive, documentDefaultDataLoader, textSplitterCharacterTextSplitter, embeddingsOpenAi. Event-driven trigger; 17 nodes.

Source: https://github.com/DrCannata/AgenticAI/blob/6f191dd8412cd76bbb543deee739e1f150b4d041/n8n/Use_Vectors_in_RAG.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Chat with docs - 5minAI New version. Uses httpRequest, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Event-driven trigger; 62 nodes.

HTTP Request, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +10
AI & RAG

I prepared a detailed guide that illustrates the entire process of building an AI agent using Supabase and Google Drive within N8N workflows.

HTTP Request, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +10
AI & RAG

RAG AI Agent Template V5. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, googleDrive. Event-driven trigger; 56 nodes.

OpenAI Chat, Document Default Data Loader, OpenAI Embeddings +12
AI & RAG

OIL Rag. Uses lmChatOpenAi, embeddingsOpenAi, agent, telegramTrigger. Event-driven trigger; 53 nodes.

OpenAI Chat, OpenAI Embeddings, Agent +12
AI & RAG

Code Extractfromfile. Uses manualTrigger, sort, httpRequest, compression. Event-driven trigger; 50 nodes.

HTTP Request, Compression, Edit Image +15