Code Monkey home page Code Monkey logo

telegram-llm-bot's Introduction

telegram-llm-bot

Telegram bot that lets you interact with ChatGPT with additional context and some implemented agents.

Demo

Prerequisites

  • Linux computer or WSL (tested on Ubuntu 22.04)
  • Tested on Python 3.10
  1. Create an OpenAI account and get an API key (see https://platform.openai.com/docs/quickstart for reference)
  2. Create a Telegram bot using BotFather (see https://core.telegram.org/bots/tutorial for reference)
  3. 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>

Getting started

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

Available Agents

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.

Known Issues

  • No user management: If several users use the bot at the same time, the context is shared between them.

Notes

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.

License

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

telegram-llm-bot's People

Contributors

csron avatar

Watchers

Kostas Georgiou avatar  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.