GithubHelp home page GithubHelp logo

irinamartynovar / universal-llm-chatbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kpekep/universal-llm-chatbot

0.0 0.0 0.0 27 KB

Universal LLM Telegram chatbot in Python

License: MIT License

Python 100.00%

universal-llm-chatbot's Introduction

Universal LLM ChatBot

Universal LLM ChatBot is a versatile Telegram bot that leverages Large Language Models (LLMs) for natural language processing, voice transcription, and text-to-speech capabilities. It supports multiple languages and provides a customizable interface for interacting with AI models.

Features

  • Multi-language support
  • Voice message transcription
  • Text-to-speech responses
  • Customizable AI model settings
  • User-specific configurations
  • Rate limiting to prevent abuse
  • Admin commands for user management

Prerequisites

  • Python 3.8+
  • Telegram Bot Token (obtain from BotFather)
  • Ollama server running locally or remotely

Installation

  1. Clone the repository:

    git clone https://github.com/KPEKEP/universal-llm-chatbot.git
    cd universal-llm-chatbot
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Copy the config_template.yml to config.yml and update it with your settings:

    cp config_template.yml config.yml
    
  4. Edit config.yml to include your Telegram Bot Token and other configurations.

Configuration

The config.yml file contains all the necessary settings for the bot. Key configurations include:

  • Telegram bot token
  • Admin user IDs
  • Access mode (public or whitelist)
  • AI provider settings
  • Rate limiting parameters

Refer to the comments in config_template.yml for detailed explanations of each setting.

Usage

To start the bot, run:

python main.py

The bot will now be active and respond to messages on Telegram.

Extending Beyond BasicProvider

The Universal LLM ChatBot is designed to be extensible. To create a new provider:

  1. Create a new file in the bot/providers/ directory (e.g., custom_provider.py).
  2. Implement a class that inherits from the Provider base class in bot/provider.py.
  3. Override the abstract methods: generate_response, transcribe_voice, and text_to_speech.
  4. Update the config.yml to use your new provider.

Example:

from bot.provider import Provider

class CustomProvider(Provider):
    def __init__(self, provider_name, config):
        super().__init__(provider_name, config)
        # Initialize your custom provider here

    async def generate_response(self, model, messages, options):
        # Implement your custom response generation logic

    async def transcribe_voice(self, input_filename):
        # Implement your custom voice transcription logic

    async def text_to_speech(self, text, output_filename, language="en", speaker=None):
        # Implement your custom text-to-speech logic

Ollama Setup

For detailed instructions on setting up Ollama for local inference, please refer to the Ollama documentation.

Acknowledgements

This project utilizes several open-source libraries and models:

Appreciation

If you use this project in your research or application, please give it a star

License

This project is licensed under the MIT License - see the LICENSE file for details.

universal-llm-chatbot's People

Contributors

kpekep 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.