Skip to main content

OpenAI GPT, driven by Telegram

Project description

TeLLMgramBot

Telegram BOT + LLM Encapsulation

The basic goal of this project is to create a bridge between a Telegram Bot and a Large Langage Model, like ChatGPT.

The telegram interface handles special commands, and even some basic "chatty" prompts and reponses that don't require a LLM to interpret, like saying "Hello". The more dynamic conversation gets handed off to the LLM to manage prompts and responses, and Telegram acts as the interaction broker. The bot can also handle URLs. If you want the bot to interpret a URL, pass it a url [in brackets] and mention what you want the bot to do with it. (e.g. - What do you think of this article? [https://some_site/article])

Using Telegram as the interface not only solves "exposing" the interface, but gives you boadloads of interactivity over a standard Command Line interface, or trying to create a website with input boxes and submit buttons to try to handle everything:

  1. Telegram already lets you paste in verbose, multiline messages.
  2. Telegram already lets you paste in pictures, videos, links, etc.
  3. Telegram already lets you react with emojis, stickers, etc.

To function, the bot requires 3 API keys:

OpenAI - To drive the actual GPT AI Tellegram Bot - Get via chatting with BotFather VirusTotal - To perform safety checks on URLs

To initialize the bot, install via pip (pip install TeLLMgramBot) and then import into your project.

Instantiate the bot passing in the various necessary configuration pieces:

telegram_bot = TeLLMgramBot.TelegramBot( bot_username=bot_uname, bot_nickname=bot_nick, bot_initials=bot_initials, bot_owner=bot_owner_uname, bot_owner_uid=bot_owner_uid, chatmodel=model, persona_name=bot_name, persona_prompt=starter_prompt )

And then run by calling: telegram_bot.start_polling()

Once you see "Polling..." the bot is online - switch to Tellegram and initiate a conversation with your bot there, and pass it the /start command.

The bot will only respond to the /start command coming from the bot_owner_uid of the owner specified.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TeLLMgramBot-1.0.2.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TeLLMgramBot-1.0.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file TeLLMgramBot-1.0.2.tar.gz.

File metadata

  • Download URL: TeLLMgramBot-1.0.2.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for TeLLMgramBot-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4fc35ed725acecf8a1532f527adf455e64b89158c46dfe7cef4e36bdb9c5508c
MD5 b8784cf78d7f59f728ea71a29e0408a8
BLAKE2b-256 c9889c393015b575f1868c307880cba9b6de74fa15141e18b0736441dfa6617a

See more details on using hashes here.

File details

Details for the file TeLLMgramBot-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: TeLLMgramBot-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for TeLLMgramBot-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9813ce8cad78bc871072d7e71d86a83eb057e735c461e62517db64c1104d2654
MD5 aeeb1ee1ba9c51a24b332b72fe2b55f5
BLAKE2b-256 3b7d68d120938385cd06ad5c095709401ca66005263c252a00289828dbefd0d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page