Local Document Chatbot with Groq & Cohere RAG
detail.loadingPreview
Empower your applications with a custom AI chatbot capable of answering questions based on your private documents. This n8n workflow leverages Retrieval Augmented Generation (RAG) with Groq and Cohere to provide accurate, context-aware responses from locally stored data.
About This Workflow
This powerful n8n workflow demonstrates how to build an intelligent Q&A system for your unstructured data using a Retrieval Augmented Generation (RAG) architecture. It automates the process of ingesting local text files, splitting them into manageable chunks, and embedding them into an in-memory vector store using Cohere. When a user asks a question via the integrated chat trigger, the workflow dynamically retrieves the most relevant document segments (after embedding the query with Cohere) from the same in-memory store and passes them, along with the user's query, to a high-performance Groq Llama-3 chat model. This ensures that the AI's responses are grounded in your specific data, providing factual and up-to-date answers without hallucinations, all within a self-contained n8n environment for rapid prototyping and local knowledge retrieval.
Key Features
- Local Document Ingestion: Easily load and process text content from local files (e.g.,
news.txt). - Intelligent Text Splitting: Utilizes a Recursive Character Text Splitter with markdown awareness to optimally segment documents for embedding.
- Efficient Embeddings with Cohere: Generates high-quality, multilingual vector embeddings for both document chunks and user queries using Cohere's advanced models.
- Lightning-Fast LLM Inference with Groq: Leverages the Groq Llama-3 chat model for incredibly fast and coherent answer generation based on retrieved context.
- In-Memory Vector Store: Provides a simple, self-contained vector storage solution for quick setup and demonstration, ideal for immediate testing and prototyping.
- Chat Interface Integration: Features a dedicated chat trigger to seamlessly integrate with user-facing applications and provide interactive Q&A.
How To Use
- Configure Local File: Ensure your
news.txt(or any text file) is accessible at the path/tmp/external_data/news.txt(or adjust the path in theRead/Write Files from Disknode). - Set up Credentials:
- Obtain a Cohere API key and configure the
CohereApicredential for bothEmbeddings Coherenodes. - Obtain a Groq API key and configure the
GroqApicredential for theGroq Chat Modelnode.
- Obtain a Cohere API key and configure the
- Load Your Data: Click the 'Test Workflow' button (connected to 'When clicking 'Test Workflow' button' node) to ingest and embed your document content into the in-memory vector store.
- Start Chatting: Use the 'Chat' button (connected to 'When clicking 'Chat' button below' node) to interact with your AI chatbot and ask questions based on your loaded documents.
Apps Used
Workflow JSON
{
"id": "47a7e340-8c92-4e80-b6f0-328d17cce472",
"name": "Local Document Chatbot with Groq & Cohere RAG",
"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: 47a7e340-8c92...
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.