Telegram RAG AI Agent with Custom Knowledge
detail.loadingPreview
Build an AI chatbot on Telegram that answers questions based on your uploaded documents using Retrieval Augmented Generation (RAG). This workflow uses Langchain nodes for document processing, vector storage, and AI interaction, with Telegram triggers and replies.
🚀Ready to Deploy This Workflow?
About This Workflow
Overview
This n8n workflow creates a powerful AI chatbot accessible via Telegram. It leverages Retrieval Augmented Generation (RAG) to allow users to upload their own documents (PDFs, CSVs) and then ask questions that the AI answers based only on the provided knowledge base. The workflow breaks down into several key stages:
- Document Ingestion and Processing: When a user uploads a file via the
Upload your file hereform, the workflow uses theRecursive Character Text Splitterto break down the document into manageable chunks. - Vector Embedding and Storage: The
Embeddings HuggingFace Inferencenode converts these text chunks into numerical vectors. These vectors are then stored in an in-memory vector store (Simple Vector Store), indexed byvector_store_key. - User Query Handling: Incoming messages from Telegram (
Telegram Message Trigger1) are captured. The user's query is then processed by anAI Agent1. - Information Retrieval: The
AI Agent1uses theRetrieve documentsnode to search the vector store for relevant information based on the user's query. - AI Response Generation: The
Groq Chat Modelis utilized by theAI Agent1to generate a response, strictly adhering to the system prompt which confines its knowledge to the retrieved documents. - Telegram Reply: The final answer is sent back to the user in Telegram using the
Reply in Telegram1node.
This workflow is ideal for creating custom Q&A bots, internal knowledge base assistants, or any application where an AI needs to answer questions based on a specific, user-provided set of information.
Key Features
- Telegram Integration: Seamlessly receive messages and send replies via Telegram.
- Custom Knowledge Base: Upload your own documents (PDF, CSV) to create a personalized knowledge base for the AI.
- Retrieval Augmented Generation (RAG): AI answers are grounded in your uploaded content, preventing hallucinations and ensuring relevance.
- Document Chunking: Intelligent splitting of large documents into smaller, manageable pieces for effective embedding.
- In-Memory Vector Store: Efficient storage and retrieval of document embeddings.
- Flexible AI Model: Utilizes Langchain's capabilities with integration for models like Groq.
- Form-Based File Upload: User-friendly method for submitting documents.
How To Use
- Set up Telegram Credentials: Ensure your Telegram Bot Token is configured in n8n.
- Configure Groq and HuggingFace Credentials: Provide your API keys for the
Groq Chat ModelandEmbeddings HuggingFace Inferencenodes. - Access the Workflow: Use the
Upload your file hereform provided by theformTriggernode. - Upload Documents: Submit your PDF or CSV files through the form.
- Interact via Telegram: Once files are processed, send messages to your Telegram bot. The AI will respond based on the uploaded documents.
- Monitor Execution: Observe the n8n workflow execution to track document processing and AI responses.
Apps Used
Workflow JSON
{
"id": "0d0487b5-7462-4472-8668-6895e798896f",
"name": "Telegram RAG AI Agent with Custom Knowledge",
"nodes": 0,
"category": "AI & Machine Learning",
"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: 0d0487b5-7462...
About the Author
Crypto_Watcher
Web3 Developer
Automated trading bots and blockchain monitoring workflows.
Statistics
Verification Info
Related Workflows
Discover more workflows you might like
Visa Requirement Checker
A workflow to check visa requirements based on user input, leveraging Langchain, Cohere embeddings, Weaviate vector store, and Anthropic LLM.
AI Assistant for Structured Metadata Generation
Automates the generation of structured metadata in English and Chinese using AI, leveraging communication platforms and various data sources.
NeurochainAI Basic API Integration for Telegram
Integrates NeurochainAI's text and image generation APIs with a Telegram bot.