My Personal AI Assistant
Project description
MPAIA (My Personal AI Assistant)
A Python package for your personal AI assistant with Telegram integration and OpenAI capabilities.
Installation
You can install MPAIA using pip:
pip install mpaia
Alternatively, you can install from the source:
-
Clone the repository:
git clone https://github.com/sTomerG/mpaia.git cd mpaia
-
Install the package:
pip install -e .
Configuration
Create a .env
file in the virtual environment with mpaia installed with the following content:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
OPENAI_API_KEY=your_openai_api_key
ALLOWED_CHAT_IDS=comma_separated_list_of_allowed_chat_ids
ADMIN_CHAT_ID=your_admin_chat_id
Replace the placeholders with your actual values.
Usage
-
Create custom jobs by subclassing
TelegramMessageJob
in a new file calledcustom_jobs.py
. For example:from mpaia.jobs import TelegramMessageJob from mpaia.assistant import Assistant class SalaryJob(TelegramMessageJob): def __init__(self, chat_id: int, assistant: Assistant): super().__init__( "0 8 1 * *", # Run on the first day of every month at 8 AM "Generate a friendly reminder that it's salary day", chat_id, assistant ) # Add any additional initialization here async def execute(self, bot): # Optionally implement your custom execution logic here await super().execute(bot)
-
Create a
run_bot.py
file and run your bot:import asyncio from custom_jobs import SalaryJob from dotenv import load_dotenv from mpaia.assistant import OpenAIAssistant from mpaia.telegram_bot import TelegramBot async def run_bot(): load_dotenv(override=True) assistant = OpenAIAssistant() bot = TelegramBot(assistant) # Add custom jobs if bot.allowed_chat_ids: for chat_id in bot.allowed_chat_ids: bot.add_job(SalaryJob(chat_id, assistant)) await bot.run() if __name__ == "__main__": asyncio.run(run_bot())
-
Run your bot:
python run_bot.py
Customization
- To add more custom jobs, create new classes in
custom_jobs.py
and add them to the bot inrun_bot.py
. - Modify the
OpenAIAssistant
parameters inrun_bot.py
to change the AI model or its behavior.
Note
Ensure that your Telegram bot has the necessary permissions to send messages in the allowed chats.
For more detailed information on the MPAIA package and its components, refer to the source code and docstrings in the src/mpaia
directory.
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
File details
Details for the file mpaia-0.1.0a1.tar.gz
.
File metadata
- Download URL: mpaia-0.1.0a1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56852d99aa2fba46030f82e1e948cc927f6ce6da1abe1ef30641d616085a6adb |
|
MD5 | fd4dad4f89736476e7cc54ef4d6421b5 |
|
BLAKE2b-256 | a68a5138876bd1b8b7138b9900b2b508b7fe3cf9633984ae7e0ae36aba29c245 |
File details
Details for the file mpaia-0.1.0a1-py3-none-any.whl
.
File metadata
- Download URL: mpaia-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4536baa1128e444fdab32827a28b70c435fdc5cff98990e3fcbc04fefda50804 |
|
MD5 | 6233ae9f61e4e07e46f014dd2cb33668 |
|
BLAKE2b-256 | 4f21d8d9460c7a3019b3224b219e3bfdd6cacaa0a4622b8b3e830484af1107f6 |