GithubHelp home page GithubHelp logo

bschwab / ollama-telegram Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruecat/ollama-telegram

0.0 0.0 0.0 130 KB

๐Ÿฆ™ Ollama Telegram bot, with advanced configuration

License: MIT License

Python 94.81% Dockerfile 5.19%

ollama-telegram's Introduction


๐Ÿฆ™ Ollama Telegram Bot

Chat with your LLM, using Telegram bot!
Feel free to contribute!



Features

Here's features that you get out of the box:

  • Fully dockerized bot
  • Response streaming without ratelimit with SentenceBySentence method
  • Mention [@] bot in group to receive answer

Roadmap

  • Docker config & automated tags by StanleyOneG, ShrirajHegde
  • History and /reset by ShrirajHegde
  • Add more API-related functions [System Prompt Editor, Ollama Version fetcher, etc.]
  • Redis DB integration
  • Update bot UI

Prerequisites

Installation (Non-Docker)

  • Install latest Python

  • Clone Repository

    git clone https://github.com/ruecat/ollama-telegram
    
  • Install requirements from requirements.txt

    pip install -r requirements.txt
    
  • Enter all values in .env.example

  • Rename .env.example -> .env

  • Launch bot

    python3 run.py
    

Installation (Docker Image)

The official image is available at dockerhub: ruecat/ollama-telegram

  • Download .env.example file, rename it to .env and populate the variables.

  • Create docker-compose.yml (optionally: uncomment GPU part of the file to enable Nvidia GPU)

    version: '3.8'
    services:
      ollama-telegram:
        image: ruecat/ollama-telegram
        container_name: ollama-telegram
        restart: on-failure
        env_file:
          - ./.env
      
      ollama-server:
        image: ollama/ollama:latest
        container_name: ollama-server
        volumes:
          - ./ollama:/root/.ollama
        
        # Uncomment to enable NVIDIA GPU
        # Otherwise runs on CPU only:
    
        # deploy:
        #   resources:
        #     reservations:
        #       devices:
        #         - driver: nvidia
        #           count: all
        #           capabilities: [gpu]
    
        restart: always
        ports:
          - '11434:11434'
  • Start the containers

    docker compose up -d

Installation (Build your own Docker image)

  • Clone Repository

    git clone https://github.com/ruecat/ollama-telegram
    
  • Enter all values in .env.example

  • Rename .env.example -> .env

  • Run ONE of the following docker compose commands to start:

    1. To run ollama in docker container (optionally: uncomment GPU part of docker-compose.yml file to enable Nvidia GPU)

      docker compose up --build -d
      
    2. To run ollama from locally installed instance (mainly for MacOS, since docker image doesn't support Apple GPU acceleration yet):

      docker compose up --build -d ollama-telegram
      

Environment Configuration

Parameter Description Required? Default Value Example
TOKEN Your Telegram bot token.
[How to get token?]
Yes yourtoken MTA0M****.GY5L5F.****g*****5k
ADMIN_IDS Telegram user IDs of admins.
These can change model and control the bot.
Yes 1234567890
OR
1234567890,0987654321, etc.
USER_IDS Telegram user IDs of regular users.
These only can chat with the bot.
Yes 1234567890
OR
1234567890,0987654321, etc.
INITMODEL Default LLM No llama2 mistral:latest
mistral:7b-instruct
OLLAMA_BASE_URL Your OllamaAPI URL No localhost
host.docker.internal

Credits

Libraries used

ollama-telegram's People

Contributors

ruecat avatar shrirajhegde avatar hynet-mel avatar stanleyoneg 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.