OpenAI GPT, driven by Telegram
Project description
TeLLMgramBot
The basic goal of this project is to create a bridge between a Telegram Bot and a Large Langage Model (LLM), like ChatGPT.
Telegram Bot + LLM Encapsulation
- 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])
Why Telegram?
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:
- Telegram already lets you paste in verbose, multiline messages.
- Telegram already lets you paste in pictures, videos, links, etc.
- Telegram already lets you react with emojis, stickers, etc.
API Keys
To function, the bot requires three API keys:
- OpenAI - Drives the actual GPT AI.
- BotFather - Helps create a new Telegram bot and provide its API.
- VirusTotal - Performs safety checks on URLs.
Bot Setup
- To initialize the bot, install via PIP (
pip install TeLLMgramBot) and then import into your project. - Instantiate the bot by passing in various configuration pieces needed. Use OpenAI Playground to test more your prompt.
telegram_bot = TeLLMgramBot.TelegramBot( bot_username = <Bot username like 'friendly_bot'>, bot_nickname = <Bot nickname like 'Botty'>, bot_initials = <Bot initials like 'FB'>, bot_owner = <Bot owner's username>, chatmodel = <ChatGPT model type like 'gpt-3.5-turbo'>, persona_name = <Bot name like 'Friendly Bot'> persona_prompt = <Prompt like 'prompts/url_analysis.prmpt' on bot's characteristics> persona_temp = <LLM value between 0 and 2 on being factual vs. creative> ) - Run by calling:
telegram_bot.start_polling() - Once you see
Polling..., the bot is online. Switch to Telegram and initiate a conversation with your bot there by passing the/startcommand.- NOTE: The bot will only respond to the
/startcommand coming from thebot_ownerusername.
- NOTE: The bot will only respond to the
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file TeLLMgramBot-1.0.4.tar.gz.
File metadata
- Download URL: TeLLMgramBot-1.0.4.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84bc2ae83d869997972d1289f523ac88b2bb96b4173871a0f35b978c91e20ca8
|
|
| MD5 |
f27e10d614a168a1ac437c223bdd1590
|
|
| BLAKE2b-256 |
26be4d270c8ff1cdba82781418ddc5744028e395ded8c05a635c2d0f0a270a51
|
File details
Details for the file TeLLMgramBot-1.0.4-py3-none-any.whl.
File metadata
- Download URL: TeLLMgramBot-1.0.4-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2106f67a5c1fb570085dc2c52c0cd90c5987c9030769f7e214e199c3f4e1f004
|
|
| MD5 |
952973a533e727f081df29b192332a76
|
|
| BLAKE2b-256 |
82bcf6d0f79ee128fed507a9bb94a8aa615e28764be62793dd62b0a2c0e74c97
|