Skip to main content

Chat with internal documents using Ollama, Supabase Vector DB & Google Drive

Workflow preview

Workflow preview
100%
Chat with internal documents using Ollama, Supabase Vector DB & Google Drive preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Chat with Internal Documents (RAG AI Agent) Features Answers should given only within provided text. Chat interface powered by LLM (Ollama) Retrieval Augmented Generation (RAG) using Supabase ...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.documentdefaultdataloader, n8n-nodes-base.stickynote, n8n-nodes-base.googledrive, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.memorypostgreschat, n8n-nodes-base.supabase, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Lakindu Siriwardana.

Original n8n.io source

1.1 Workflow description

Title
Chat with internal documents using Ollama, Supabase Vector DB & Google Drive
Workflow name
Chat with internal documents using Ollama, Supabase Vector DB & Google Drive

πŸ“š Chat with Internal Documents (RAG AI Agent)

βœ… Features

  • Answers should given only within provided text.
  • Chat interface powered by LLM (Ollama)
  • Retrieval-Augmented Generation (RAG) using Supabase Vector DB
  • Multi-format file support (PDF, Excel, Google Docs, text files)
  • Automated file ingestion from Google Drive
  • Real-time document update handling
  • Embedding generation via Ollama for semantic search
  • Memory-enabled agent using PostgreSQL
  • Custom tools for document lookup with context-aware chat

βš™οΈ How It Works

πŸ“₯ Document Ingestion & Vectorization

Watches a Google Drive folder for new or updated files.

Deletes old vector entries for the file.

Uses conditional logic to extract content from PDFs, Excel, Docs, or text

Summarizes and preprocesses content. (if needed)

Splits and embeds the text via Ollama.

Stores embeddings in Supabase Vector DB

πŸ’¬ RAG Chat Agent

Chat is initiated via Webhook or built-in chat interface.

User input is passed to the RAG Agent.

Agent queries the User_documents tool (Supabase vector store) using the Ollama model to fetch relevant content.

If context is found, it answers directly.

Otherwise, it can call tools or request clarification.

Responses are returned to the user, with memory stored in PostgreSQL for continuity.

πŸ›  Supabase Database Configuration

  1. Create a Supabase project at https://supabase.com and go to the SQL editor.

  2. Create a documents table with the following schema:

  • id - int8
  • content - text
  • metadata - jsonb
  • embedding - vector
  1. Generate an API Key

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Download File

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 5 - File Created

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 6 - File Updated

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 7 - Extract Document Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 8 - Postgres Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1

Block 9 - Delete Old Doc Rows

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 10 - Set File ID

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Respond to Webhook

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 13 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 14 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 15 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 16 - Extract PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 17 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 18 - Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter - textSplitterCharacterTextSplitter
Config choices
Version 1

Block 19 - Summarize

Type / Role
n8n-nodes-base.summarize - summarize
Config choices
Version 1

Block 20 - RAG AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 21 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 22 - Insert into Supabase Vectorstore

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1

Block 23 - Extract from Excel

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 24 - Embeddings Ollama

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOllama - embeddingsOllama
Config choices
Version 1

Showing the first 24 of 29 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Chat with internal documents using Ollama, Supabase Vector DB & Google Drive
Complexity advanced
Nodes 29
Categories Internal Wiki, AI RAG
Author Lakindu Siriwardana
Published 02 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6894/6894.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Chat with internal documents using Ollama, Supabase Vector DB & Google Drive do?

Chat with Internal Documents (RAG AI Agent) Features Answers should given only within provided text. Chat interface powered by LLM (Ollama) Retrieval Augmented Generation (RAG) using Supabase ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.