A simple Telegram chat bot for LLMs supported by llama.cpp
Easiest way to share your selfhosted ChatGPT style interface with friends and family! Even group chat with your AI friend!
Demo.mp4
- Easy to setup and run
- Group chat
- Whitelist to restrict to a limited set of users
- Unlimited chats - Sliding window
- Typing indicator
- Streaming responses
- New chat command
- Supports LLMs supported by llama.cpp
- GPU Acceleration support
- Voice chat
- A free Telegram bot token from @BotFather
- A Llama.cpp supported model in your local system
$ git clone https://github.com/aneeshjoy/llama-telegram-bot.git
$ cd llama-telegram-bot
$ sudo pip3 install -r requirements.txt
$ export BOT_TOKEN=<Your Telegram bot token>
$ export MODEL_PATH=/path/to/your/model/file
$ python3 bot.py
For GPU acceleration specify additional environment variables:
LLAMA_CUBLAS=1 CMAKE_ARGS="-DLLAMA_CUBLAS=ON" FORCE_CMAKE=1 pip3 install -r requirements.txt
You can use pre-built docker image to run the bot. Follow these steps:
- Clone the repo or download
docker-compose.yml
$ git clone https://github.com/aneeshjoy/llama-telegram-bot.git
$ cd llama-telegram-bot
- Update BOT_TOKEN env variable in
docker-compose.yml
file - Update MODEL_PATH env variable in
docker-compose.yml
file - Update
- /path/to/models
indocker-compose.yml
to point to the folder which contains the model - Run the bot
$ docker-compose up
You can build your own docker image to run the bot. Follow these steps:
- Clone the repo
$ git clone https://github.com/aneeshjoy/llama-telegram-bot.git
$ cd llama-telegram-bot
- Update BOT_TOKEN env variable in
docker-compose-build.yml
file - Update MODEL_PATH env variable in
docker-compose-build.yml
file - Update
- /path/to/models
indocker-compose-build.yml
to point to the folder which contains the model - Run the bot
$ docker-compose -f docker-compose-build.yml up --build
Once the bot is running, you can use the following commands to generate text:
/start
- Get a welcome message from the bot./new_chat
- To start a new conversation.
To contribute, please:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes and commit them.
- Push your changes to your fork.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for more information.