https://github.com/furkan-gulsen/telegram-multi-agent-ai-bot
Telegram Multi-Agent AI Bot is an AI-driven chatbot that uses GPT-4o-mini, LangChain, and MongoDB Atlas Search for contextual conversations and intelligent responses.
https://github.com/furkan-gulsen/telegram-multi-agent-ai-bot
ai ai-agent lancgchain mongodb-atlas-s multi-agent python rag
Last synced: 7 months ago
JSON representation
Telegram Multi-Agent AI Bot is an AI-driven chatbot that uses GPT-4o-mini, LangChain, and MongoDB Atlas Search for contextual conversations and intelligent responses.
- Host: GitHub
- URL: https://github.com/furkan-gulsen/telegram-multi-agent-ai-bot
- Owner: Furkan-Gulsen
- Created: 2025-03-12T03:35:35.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-12T03:46:56.000Z (7 months ago)
- Last Synced: 2025-03-12T04:25:49.913Z (7 months ago)
- Topics: ai, ai-agent, lancgchain, mongodb-atlas-s, multi-agent, python, rag
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Telegram Multi-Agent AI Bot
**Telegram Multi-Agent AI Bot** is a powerful, AI-driven chatbot designed to intelligently process and respond to user messages on Telegram. Leveraging **OpenAI GPT-4o-mini**, **LangChain**, and **MongoDB Atlas Search**, this bot consolidates multiple short messages into a context-aware conversation, retrieves relevant information from stored documents, and generates coherent responses.
---
## 🚀 Features
- **💬 Telegram Bot Integration** – Seamlessly interacts with users on Telegram.
- **🧠 AI-Powered Message Processing** – Uses **LangChain** and **OpenAI GPT-4o-mini** for intelligent responses.
- **🪠 Contextual Memory (MongoDB Atlas Search)** – Retrieves and utilizes previous conversations for enhanced response accuracy.
- **📄 File Upload & Retrieval** – Stores documents in **MongoDB Atlas Search** for retrieval-augmented generation (RAG).
- **🗂️ MongoDB-Based Message Queue** – Manages incoming messages efficiently.
- **✨ FastAPI Web Server** – Provides a scalable and modern backend.
- **🛠️ Python Virtual Environment Support** – Ensures easy dependency management.---
## 🛠 Installation Guide
### 1. Set Up a Virtual Environment
```bash
# Create a virtual environment
make venv# Activate the virtual environment (MacOS/Linux)
source venv/bin/activate
```### 2. Install Dependencies
```bash
make install
```### 3. Set Up MongoDB Atlas
- Create a **MongoDB Atlas** cluster.
- Enable **Atlas Search** and configure an index for vector search.
- Obtain your MongoDB connection string.### 4. Configure Environment Variables
Create a `.env` file and add the following:
```env
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
OPENAI_API_KEY=your_openai_api_key
MONGODB_URI=your_mongodb_atlas_connection_string
```---
## ▶️ Usage
### 1. Activate the Virtual Environment
```bash
source venv/bin/activate
```### 2. Start the Application
```bash
make run
```### 3. Interact with the Bot
- Start by sending `/start` to the bot.
- Send multiple short messages within **15 seconds** for contextual merging.
- Upload files (PDF, TXT, etc.) to enrich responses with document-based knowledge.---
## 🎨 System Architecture
1. **Message Reception**
- The Telegram bot receives incoming messages.
- Messages are stored in a **MongoDB queue**.
2. **File Upload & Processing**
- Users upload files via Telegram.
- Documents are stored in **MongoDB Atlas Search** for future retrieval.
3. **Message Processing**
- Messages sent within **15 seconds** are consolidated.
- Context is retrieved from **MongoDB Atlas Search**, including previously uploaded documents.
- OpenAI's **GPT-4o-mini**, via **LangChain**, generates responses.4. **Response Delivery**
- The response is sent back to the user.
- Interaction data is stored in **MongoDB Atlas Search**.
- Processed messages are removed from the queue.---
## 📃 Makefile Commands
| Command | Description |
|-----------------------|-------------|
| `make venv` | Creates a virtual environment |
| `make install` | Installs dependencies |
| `make run` | Starts the application |
| `make clean` | Removes Python cache files |