Telegram bot that lets you interact with ChatGPT with additional context and some implemented agents.
- Linux computer or WSL (tested on Ubuntu 22.04)
- Tested on Python 3.10
- Create an OpenAI account and get an API key (see https://platform.openai.com/docs/quickstart for reference)
- Create a Telegram bot using BotFather (see https://core.telegram.org/bots/tutorial for reference)
- Enter your secrets and tokens as environment variables (e.g. in an
.env
file or directly in the terminal)export OPENAI_API_KEY=<your OpenAI API key> export BOT_TOKEN=<your Telegram bot token> export BOT_PASSWORD=<your Telegram bot password>
Create a virtual environment and install dependencies (requires sudo):
python3 -m venv .venv
source .venv/bin/activate
bash setup.sh
To run the bot:
python3 coobot.py
To access the agents you need to use write a command (delimeted by "/" e.g. /assistant
). The publicly available agents are:
/assistant
: This is the default agent which gives acces to ChatGPT with additional context/scan
: Send a picture of a text and get a summary/docsearch
: Searches for similar content in the provided document (concept known as "semantic search" or "Retrieval augmented generation - RAG")/docsum
: Summarizes available documents page by page
For more details regarding the software design and how to add new agents see DETAILS.md.
- No user management: If several users use the bot at the same time, the context is shared between them.
Before ChatGPT announced multimodal features, this project was pretty cool and newish. Many functions are now also implemented in ChatGPT. However, the project is still a good starting point to learn how to interact with the OpenAI API and how to build a Telegram bot.
I do not take any responsibility for the use of this bot. Use and host it at your own risk.
This project is licensed under the MIT License - see the LICENSE file for details.