Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone
This n8n template from [Intuz](https://www.intuz.com/) provides a complete solution to automate a powerful, AI-driven 'Chat with your PDF' bot on Telegram. It uses Retrieval-Augmented Generation (RAG) to allow users t...
Template notes
This n8n template from [Intuz](https://www.intuz.com/) provides a complete solution to automate a powerful, AI-driven 'Chat with your PDF' bot on Telegram.
It uses Retrieval-Augmented Generation (RAG) to allow users to upload documents, which are then indexed into a vector database, enabling the bot to answer questions based only on the provided content.
Who's this workflow for? - Researchers & Students - Legal & Compliance Teams - Business Analysts & Financial Advisors - Anyone needing to quickly find information within large documents
How it works This workflow has two primary functions: indexing a new document and answering questions about it.
1. Uploading & Indexing a Document: - A user sends a PDF file to the Telegram bot. - n8n downloads the document, extracts the text, and splits it into small, manageable chunks. - Using Google Gemini, each text chunk is converted into a numerical representation (an "embedding"). - These embeddings are stored in a Pinecone vector database, making the document's content searchable. - The bot sends a confirmation message to the user that the document has been successfully saved.
2. Asking a Question (RAG): - A user sends a regular text message (a question) to the bot. - n8n converts the user's question into an embedding using Google Gemini. - It then searches the Pinecone database to find the most relevant text chunks from the uploaded PDF that match the question. - These relevant chunks (the "context") are sent to the Gemini chat model along with the original question. - Gemini generates a new, accurate answer based only on the provided context and sends it back to the user in Telegram.
Key Requirements to Use This Template
1. n8n Instance & Required Nodes: - An active n8n account (Cloud or self-hosted). - This workflow uses the official n8n LangChain integration (@n8n/n8n-nodes-langchain). If you are using a self-hosted version of n8n, please ensure this package is installed.