A Python-based Telegram chatbot integrated with multiple AI services including OpenAI's GPT and Groq. Just something basic I use to play around with chatbots in telegram.
- Supports OpenAI GPT models with both chat completions and assistants apis and Groq models.
- Persistent user memory using both a rolling summary and a chat history window.
- Customizable prompts and templates.
- Python 3.7+
- pip
-
Clone the repository:
git clone https://github.com/tsdragon/telegram-ai-chatbot.git cd telegram-ai-chatbot
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Create your configuration file:
Copy the sample configuration file and edit it with your own API keys and settings. !!!DO NOT PUT YOUR KEYS IN THE SAMPLE CONFIG AND ACCIDETALLY UPLOAD IT TO GIT!!!
cp configs/sample_config.py configs/my_config.py
Edit
configs/my_config.py
with your own API keys, user IDs, and other settings. -
Create your instruction templates:
Ensure your templates and prompt files are set up as per your requirements. You can use the sample templates provided in the
instructions/
directory.
Run the Telegram bot with your configuration file:
python telegram_bot.py my_config