Back to Catalog

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

Lakindu SiriwardanaLakindu Siriwardana
1846 views
2/3/2026
Official Page

πŸ“š 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

Chat with Internal Documents using Ollama, Supabase Vector DB, and Google Drive

This n8n workflow enables you to interactively chat with your internal documents stored in Google Drive. It leverages Ollama for language model capabilities, Supabase as a vector database for efficient document search, and n8n's Langchain integration to orchestrate the entire process.

The workflow simplifies the process of ingesting documents from Google Drive into a vector database and then using an AI agent to answer questions based on the content of these documents.

What it does

This workflow consists of two main parts: document ingestion and chat interaction.

Document Ingestion (triggered by Google Drive changes):

  1. Monitors Google Drive: The Google Drive Trigger node listens for new or updated files in a specified Google Drive folder.
  2. Extracts File Content: The Extract from File node reads the content of the newly added or modified document.
  3. Splits Text: The Character Text Splitter node breaks down the document content into smaller, manageable chunks (for better vector embedding and search).
  4. Generates Embeddings: The Embeddings Ollama node creates vector embeddings for each text chunk using the Ollama language model.
  5. Stores in Supabase: The Supabase Vector Store node stores these embeddings and their associated text chunks in your Supabase vector database, making them searchable.

Chat Interaction (triggered by a chat message):

  1. Listens for Chat Messages: The When chat message received node acts as the entry point for user queries.
  2. Initializes AI Agent: The AI Agent node sets up a conversational AI agent.
  3. Configures Chat Model: The Ollama Chat Model node provides the conversational AI capabilities using Ollama.
  4. Configures Memory: The Postgres Chat Memory node maintains the conversation history, allowing the AI agent to remember previous interactions.
  5. Provides Document Search Tool: The Vector Store Question Answer Tool node enables the AI agent to search the Supabase vector database for relevant document chunks based on the user's query.
  6. Responds to User: The Respond to Webhook node sends the AI agent's answer back to the user.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n Instance: A running n8n instance.
  • Ollama Instance: A self-hosted or accessible Ollama instance with the desired language model (e.g., llama2, mistral) installed.
  • Supabase Account: A Supabase project with a configured vector database. You will need your Supabase URL and API Key.
  • Google Drive Account: A Google account with access to Google Drive.
  • n8n Credentials:
    • Google Drive OAuth2 credentials.
    • Supabase API Key credentials.
    • Ollama API credentials (if required by your Ollama setup).
    • Postgres credentials for chat memory (if using a separate Postgres instance, otherwise Supabase's built-in Postgres can be used).

Setup/Usage

  1. Import the workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • Google Drive: Set up your Google Drive OAuth2 credential in n8n.
    • Supabase: Set up your Supabase API Key credential in n8n, providing your Supabase URL and API Key.
    • Ollama: Configure your Ollama credentials in n8n. This might involve setting the base URL for your Ollama instance.
    • Postgres (for chat memory): If you're using a separate Postgres for chat memory, configure its credentials. If you intend to use Supabase's built-in Postgres, ensure the connection details are correctly configured within the Postgres Chat Memory node.
  3. Configure Google Drive Trigger:
    • Select your Google Drive credential.
    • Specify the Google Drive folder you want to monitor for documents.
  4. Configure Supabase Vector Store:
    • Select your Supabase credential.
    • Ensure the table name and embedding column match your Supabase vector database setup.
  5. Configure Ollama Nodes:
    • In the Embeddings Ollama node, select your Ollama credential and specify the embedding model you want to use.
    • In the Ollama Chat Model node, select your Ollama credential and specify the chat model you want to use.
  6. Configure Postgres Chat Memory:
    • Select your Postgres credential (or Supabase Postgres credential).
    • Ensure the table name for chat history is correctly configured.
  7. Activate the workflow: Once all credentials and nodes are configured, activate the workflow.

Now, any new or updated documents in your specified Google Drive folder will be automatically processed and added to your Supabase vector database. You can then interact with the AI agent by sending chat messages to the webhook URL provided by the When chat message received node (or through a custom chat interface connected to it).

Related Templates

Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets

This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitor’s webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger β€” Manually start the workflow or schedule it to run periodically. Input Setup β€” Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) β€” Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring β€” Clean and convert GPT output into JSON format. Data Storage (Google Sheets) β€” Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the β€œSet Input Fields” node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors β†’ Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection β†’ Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report β†’ Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization β†’ Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs β†’ Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting It’s a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.

Ranjan DailataBy Ranjan Dailata
161

AI-powered code review with linting, red-marked corrections in Google Sheets & Slack

Advanced Code Review Automation (AI + Lint + Slack) Who’s it for For software engineers, QA teams, and tech leads who want to automate intelligent code reviews with both AI-driven suggestions and rule-based linting β€” all managed in Google Sheets with instant Slack summaries. How it works This workflow performs a two-layer review system: Lint Check: Runs a lightweight static analysis to find common issues (e.g., use of var, console.log, unbalanced braces). AI Review: Sends valid code to Gemini AI, which provides human-like review feedback with severity classification (Critical, Major, Minor) and visual highlights (red/orange tags). Formatter: Combines lint and AI results, calculating an overall score (0–10). Aggregator: Summarizes results for quick comparison. Google Sheets Writer: Appends results to your review log. Slack Notification: Posts a concise summary (e.g., number of issues and average score) to your team’s channel. How to set up Connect Google Sheets and Slack credentials in n8n. Replace placeholders (<YOURSPREADSHEETID>, <YOURSHEETGIDORNAME>, <YOURSLACKCHANNEL_ID>). Adjust the AI review prompt or lint rules as needed. Activate the workflow β€” reviews will start automatically whenever new code is added to the sheet. Requirements Google Sheets and Slack integrations enabled A configured AI node (Gemini, OpenAI, or compatible) Proper permissions to write to your target Google Sheet How to customize Add more linting rules (naming conventions, spacing, forbidden APIs) Extend the AI prompt for project-specific guidelines Customize the Slack message formatting Export analytics to a dashboard (e.g., Notion or Data Studio) Why it’s valuable This workflow brings realistic, team-oriented AI-assisted code review to n8n β€” combining the speed of automated linting with the nuance of human-style feedback. It saves time, improves code quality, and keeps your team’s review history transparent and centralized.

higashiyama By higashiyama
90

Daily cash flow reports with Google Sheets, Slack & Email for finance teams

Simplify financial oversight with this automated n8n workflow. Triggered daily, it fetches cash flow and expense data from a Google Sheet, analyzes inflows and outflows, validates records, and generates a comprehensive daily report. The workflow sends multi-channel notifications via email and Slack, ensuring finance professionals stay updated with real-time financial insights. πŸ’ΈπŸ“§ Key Features Daily automation keeps cash flow tracking current. Analyzes inflows and outflows for actionable insights. Multi-channel alerts enhance team visibility. Logs maintain a detailed record in Google Sheets. Workflow Process The Every Day node triggers a daily check at a set time. Get Cash Flow Data retrieves financial data from a Google Sheet. Analyze Inflows & Outflows processes the data to identify trends and totals. Validate Records ensures all entries are complete and accurate. If records are valid, it branches to: Sends Email Daily Report to finance team members. Send Slack Alert to notify the team instantly. Logs to Sheet appends the summary data to a Google Sheet for tracking. Setup Instructions Import the workflow into n8n and configure Google Sheets OAuth2 for data access. Set the daily trigger time (e.g., 9:00 AM IST) in the "Every Day" node. Test the workflow by adding sample cash flow data and verifying reports. Adjust analysis parameters as needed for specific financial metrics. Prerequisites Google Sheets OAuth2 credentials Gmail API Key for email reports Slack Bot Token (with chat:write permissions) Structured financial data in a Google Sheet Google Sheet Structure: Create a sheet with columns: Date Cash Inflow Cash Outflow Category Notes Updated At Modification Options Customize the "Analyze Inflows & Outflows" node to include custom financial ratios. Adjust the "Validate Records" filter to flag anomalies or missing data. Modify email and Slack templates with branded formatting. Integrate with accounting tools (e.g., Xero) for live data feeds. Set different trigger times to align with your financial review schedule. Discover more workflows – Get in touch with us

Oneclick AI SquadBy Oneclick AI Squad
619