Intelligent RAG Chatbot with Custom Knowledge Base & OpenAI
detail.loadingPreview
Build an intelligent AI chatbot that answers questions using your custom knowledge base. This workflow leverages Retrieval Augmented Generation (RAG) with OpenAI and Supabase to provide accurate, context-aware responses based on your proprietary documents.
About This Workflow
This powerful n8n workflow empowers you to create a sophisticated RAG (Retrieval Augmented Generation) chatbot, transforming your static documents into an interactive knowledge base. It seamlessly integrates a chat interface, an intelligent LangChain agent, and OpenAI's GPT-4-mini model. The system features a robust document ingestion pipeline, pulling PDFs from Google Drive, extracting their content, and embedding them into a Supabase vector database. For enhanced accuracy, it incorporates conversation memory and a Cohere reranker to optimize search results before the AI generates its response, ensuring your chatbot provides highly relevant and well-sourced answers.
Key Features
- Intelligent RAG Agent: Orchestrates conversations, utilizing a custom knowledge base and tools for accurate, context-rich responses.
- Custom Knowledge Base: Ingests PDFs from Google Drive, extracts text, and stores embeddings in Supabase for proprietary data querying.
- Advanced AI Integration: Leverages OpenAI's GPT-4-mini for natural language understanding and generation.
- Conversational Memory: Maintains context across interactions, enabling fluid and personalized conversations.
- Enhanced Search Quality: Integrates OpenAI embeddings and a Cohere Reranker to improve the relevance and precision of retrieved information.
How To Use
- Configure Environment Variables: Before running, set the following variables in your n8n instance:
GOOGLE_DRIVE_FILE_URL: The public URL of the PDF document you want to ingest.VECTOR_TABLE_NAME: The name of your Supabase table for storing vector embeddings.MATCH_FUNCTION_NAME: The name of the Supabase function used for vector similarity search.
- Set Up Supabase Credentials: Ensure your
Knowledge Base SearchandStore in Vector Databasenodes are configured with valid Supabase API credentials. - Ingest Documents:
- Manually trigger the
Load Documents Triggernode. - The workflow will download the specified PDF from Google Drive, extract its content, create embeddings, and store them in your Supabase vector database.
- Repeat this step for all documents you wish to add to your knowledge base.
- Manually trigger the
- Engage the Chatbot: Once documents are ingested, interact with your AI assistant via the
Chat Interfacewebhook. The RAG agent will search your knowledge base, rerank results, and use the AI model to provide a precise, cited answer.
Apps Used
Workflow JSON
{
"id": "967501ab-dc93-41c9-b91b-5e3a78fe2039",
"name": "Intelligent RAG Chatbot with Custom Knowledge Base & OpenAI",
"nodes": 9,
"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: 967501ab-dc93...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Related Workflows
Discover more workflows you might like
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
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.