c9866ac7c58dfd250f38c49cb23f680117723506
Telegram Inference Bot with Daemon and Apprentice System
This project implements a Telegram bot system with two instances: a daemon bot and an apprentice bot. The daemon bot handles the main workload, while the apprentice bot can be updated and take over when needed.
Features
- Daemon bot for handling main workload
- Apprentice bot for updates and handovers
- Automatic updates for the apprentice bot when new pull requests are merged
- Inter-bot communication
- Support for both OpenAI and Anthropic AI models
- Tool integration for extended functionality
Setup
-
Clone the repository:
git clone https://github.com/your_username/your_repo_name.git cd your_repo_name -
Install the required dependencies:
pip install -r requirements.txt -
Copy the
.env.examplefile to.envand fill in your actual values:cp .env.example .env -
Edit the
.envfile with your specific tokens and settings. -
Run the bot:
python telegram_inference_bot.py
Environment Variables
Make sure to set the following environment variables in your .env file:
TELEGRAM_BOT_TOKEN: Token for the daemon botTELEGRAM_APPRENTICE_BOT_TOKEN: Token for the apprentice botOPENAI_API_KEY: Your OpenAI API keyANTHROPIC_API_KEY: Your Anthropic API keyGITHUB_REPO_OWNER: Your GitHub username or organizationGITHUB_REPO_NAME: Your repository nameGITHUB_ACCESS_TOKEN: Your GitHub personal access tokenDAEMON_CHAT_ID: Chat ID for the daemon botAPPRENTICE_CHAT_ID: Chat ID for the apprentice bot
Usage
- Start the bot by running
python telegram_inference_bot.py - Use
/startto begin interacting with either bot - Use
/handoverin the daemon bot to initiate a handover to the apprentice bot - The apprentice bot will automatically check for updates every 15 minutes
Commands
/start: Start interacting with the bot/clear: Clear conversation history/switch: Switch between GPT models (GPT-4 and GPT-4 Mini)/toggle: Toggle between OpenAI and Anthropic providers/status: Check the current model and provider/handover: (Daemon bot only) Initiate handover to apprentice bot/update: (Apprentice bot only) Manually trigger an update
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Description
Languages
Python
100%