Skip to content

KonstantinVanov/Article-Assistant--RAG-Telegram-Bot

Article Assistant (RAG Telegram Bot)

Python Version Docker License: MIT Telegram Bot OpenAI RAG PDF Support

Contact: @Konstantin_vanov

A Telegram bot for Q&A about articles using Retrieval-Augmented Generation. Indexes web content and PDF files, then provides accurate answers with sources.

LOGO

Examples

Answer Examples

Welcome

πŸ“– Table of Contents

🌟 Features

  • Web Article Processing - Index content from URLs βœ…
  • YouTube Video Processing - Download and transcribe YouTube videos βœ…
  • Multilingual Support - English/Russian interfaces βœ…
  • Q&A System - Ask questions about indexed content βœ…
  • Text Summarization - Generate key points summaries βœ…
  • PDF File Support - Upload and process PDF documents βœ…
  • TXT File Support - Process text files directly βœ…
  • No Request Limits - Unlimited questions and processing βœ…
  • Custom Prompts - Adjust AI behavior and responses βœ…

πŸš€ Quick Start

Prerequisites

RAG System Workflow

Scheme Scheme

🐳 Docker Deployment (Recommended)

The easiest way to deploy with all dependencies included:

Prerequisites

Quick Start with Docker

# Clone the repository
git clone https://github.com/Konstantin-vanov-hub/Article-Assistant--RAG-Telegram-Bot.git
cd Article-Assistant--RAG-Telegram-Bot

# Configure environment variables
cp .env.example .env
# Edit .env with your Telegram Bot Token and OpenAI API Key
nano .env

# Build and start the containers
docker-compose up -d --build

# View logs to verify everything is working
docker-compose logs -f telegram-bot

Docker Commands

Command Description
docker-compose up -d --build Build and start in background
docker-compose down Stop and remove containers
docker-compose logs -f telegram-bot Follow bot logs
docker-compose restart telegram-bot Restart only the bot

πŸ”§ Traditional Installation (Without Docker)

Clone and Setup

git clone https://github.com/Konstantin-vanov-hub/Article-Assistant--RAG-Telegram-Bot
cd Article-Assistant--RAG-Telegram-Bot
python -m venv venv
source venv/bin/activate  # Linux/Mac
venv\Scripts\activate     # Windows
pip install -r requirements.txt

Configuration

cp .env.example .env

Environment Variables

Create a .env file with:

TELEGRAM_TOKEN=your_telegram_bot_token_here
OPENAI_API_KEY=your_openai_api_key_here

Launch

python RAG_bot/bot_main.py

πŸ“± Usage Examples

  1. Upload a PDF: Send a PDF file to the bot
  2. Process YouTube Videos: Enter a YouTube URL to download and transcribe
  3. Ask questions: Type your question after indexing
  4. Get summaries: Use the "Summary" button for key points
  5. Change language: Use the language button to switch between English/Russian

YouTube Video Processing

The bot can now process YouTube videos! Here's how:

  1. Click "πŸ“Ή Process YouTube Video" in the main menu
  2. Paste a YouTube video URL
  3. The bot will:
    • Download the video audio
    • Transcribe it using OpenAI Whisper
    • Index the transcript for Q&A
  4. Ask questions about the video content
  5. Get summaries of the video

Supported formats: YouTube URLs (youtube.com, youtu.be) Limitations: Videos up to 2 hours maximum

πŸ”§ Troubleshooting

Common Issues

  • Bot not responding: Check if all environment variables are set correctly
  • Indexing fails: Ensure OpenAI API key is valid and has sufficient credits
  • File upload issues: Check file size limits (max 10MB for files)
  • Vector store errors: Delete faiss_index folder and re-index your content
  • YouTube processing fails:
    • Ensure video is not longer than 2 hours
    • Check if the YouTube URL is valid and accessible
    • Verify Whisper model is properly installed
    • Check available disk space for temporary files

Getting Help

  • Check the logs: docker-compose logs -f telegram-bot
  • Verify environment variables are loaded
  • Ensure OpenAI API key has sufficient credits

🀝 Contributing

We love contributions! Please read our Contributing Guide to learn how you can help improve this project.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/improvement)
  5. Open a Pull Request

πŸ“œ License

MIT License Β© 2025 Konstantin. See LICENSE file for details.

πŸ“¬ Support

For assistance, please:

About

A sophisticated RAG (Retrieval-Augmented Generation) Telegram bot that transforms articles and documents into interactive knowledge bases. Upload PDFs/URLs and get AI-powered answers with source citations.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors