Google Drive to AI Knowledge Base: Smart RAG Agent with Chat Memory
detail.loadingPreview
Transform your Google Drive documents into an intelligent AI knowledge base with this n8n workflow. It automatically ingests files, extracts text, creates embeddings, and stores them in a PGVector database, enabling a powerful RAG AI agent with conversational memory to answer questions contextually.
About This Workflow
This n8n workflow establishes a sophisticated, automated system to convert your Google Drive files into a dynamic, AI-powered knowledge base. Upon file creation or update in Google Drive, the workflow seamlessly downloads the document, extracts its text content, and intelligently splits it into manageable chunks. These chunks are then transformed into vector embeddings using OpenAI's powerful models and securely stored in a Postgres database enhanced with the PGVector extension. The core of this solution is a Retrieval Augmented Generation (RAG) AI Agent, also powered by OpenAI, which leverages this robust vector store to provide highly accurate and contextual answers to queries. With integrated chat memory, the agent maintains conversational flow, making it ideal for building intelligent, document-aware query systems.
Key Features
- Automated Google Drive Ingestion: Automatically processes new or updated files from specified Google Drive folders.
- Intelligent Text Extraction & Chunking: Extracts text from various document types and uses a Recursive Character Text Splitter to prepare content for vectorization.
- OpenAI Embeddings & PGVector Storage: Generates high-quality document embeddings with OpenAI and stores them efficiently in a scalable Postgres PGVector database.
- Retrieval Augmented Generation (RAG) Agent: Empowers an OpenAI-driven AI agent to intelligently retrieve relevant information from your document knowledge base for contextual and accurate answers.
- Conversational Chat Memory: Maintains context across interactions using Postgres Chat Memory, providing a more natural and intelligent chat experience.
How To Use
- Configure Google Drive Triggers: Set up the
File CreatedandFile UpdatedGoogle Drive triggers to monitor the specific folder(s) where your documents reside. Provide your Google Drive credentials to authenticate. - Set up OpenAI Credentials: Connect the
OpenAI Chat ModelandEmbeddings OpenAInodes with your OpenAI API key for text generation and vectorization services. - Configure Postgres Database: Set up the
Postgres PGVector StoreandChat Memorynodes with your PostgreSQL database connection details. Ensure thepgvectorextension is installed and configured on your database instance. - Adjust Text Splitting (Optional): Modify parameters in the
Recursive Character Text Splitternode if you need to fine-tune how your documents are broken into chunks (e.g., chunk size, overlap). - Test the Ingestion Workflow: Upload a test document to your monitored Google Drive folder and execute the workflow to ensure it's processed, chunked, and stored correctly in your PGVector database.
- Integrate the RAG Agent: This workflow is designed to be triggered by another workflow. Ensure your calling workflow provides the necessary input (e.g., user query) to the
When Executed by Another Workflownode for the RAG agent to process queries effectively.
Apps Used
Workflow JSON
{
"id": "a45bf42d-07f3-4dde-a4a8-be7bb5f50f9e",
"name": "Google Drive to AI Knowledge Base: Smart RAG Agent with Chat Memory",
"nodes": 16,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: a45bf42d-07f3...
About the Author
SaaS_Connector
Integration Guru
Connecting CRM, Notion, and Slack to automate your life.
Statistics
Related Workflows
Discover more workflows you might like
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.
Automate Getty Images Editorial Search & CMS Integration
This n8n workflow automates searching for editorial images on Getty Images, extracts key details and embed codes, and prepares them for seamless integration into your Content Management System (CMS), streamlining your content creation process.