Giter Site home page Giter Site logo

llama-telegram-bot's Introduction

Llama.cpp Telegram Bot

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

Demo.mp4

Features

  1. Easy to setup and run
  2. Group chat
  3. Whitelist to restrict to a limited set of users
  4. Unlimited chats - Sliding window
  5. Typing indicator
  6. Streaming responses
  7. New chat command
  8. Supports LLMs supported by llama.cpp
  9. GPU Acceleration support
  10. Voice chat

Installation

What do you need?

  1. A free Telegram bot token from @BotFather
  2. A Llama.cpp supported model in your local system

Manual Installation

$ 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

GPU Acceleration

For GPU acceleration specify additional environment variables:

LLAMA_CUBLAS=1 CMAKE_ARGS="-DLLAMA_CUBLAS=ON" FORCE_CMAKE=1 pip3 install -r requirements.txt

Using Prebuilt Docker image

You can use pre-built docker image to run the bot. Follow these steps:

  1. Clone the repo or download docker-compose.yml
$ git clone https://github.com/aneeshjoy/llama-telegram-bot.git
$ cd llama-telegram-bot
  1. Update BOT_TOKEN env variable in docker-compose.yml file
  2. Update MODEL_PATH env variable in docker-compose.yml file
  3. Update - /path/to/models in docker-compose.yml to point to the folder which contains the model
  4. Run the bot
$ docker-compose up

Using Self built Docker image

You can build your own docker image to run the bot. Follow these steps:

  1. Clone the repo
$ git clone https://github.com/aneeshjoy/llama-telegram-bot.git
$ cd llama-telegram-bot
  1. Update BOT_TOKEN env variable in docker-compose-build.yml file
  2. Update MODEL_PATH env variable in docker-compose-build.yml file
  3. Update - /path/to/models in docker-compose-build.yml to point to the folder which contains the model
  4. Run the bot
$ docker-compose -f docker-compose-build.yml up --build 

Usage

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.

Contributing

To contribute, please:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes and commit them.
  4. Push your changes to your fork.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Credits

llama-telegram-bot's People

Contributors

aneeshjoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.