Skip to main content

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:

  1. Clone the repository:

    git clone https://github.com/sTomerG/mpaia.git
    cd mpaia
    
  2. 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

  1. Create custom jobs by subclassing TelegramMessageJob in a new file called custom_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)
    
  2. 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())
    
  3. 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 in run_bot.py.
  • Modify the OpenAIAssistant parameters in run_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.

Metadata

Release files for mpaia 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpaia 0.1.1
File Size Uploaded Provenance
mpaia-0.1.1.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mpaia 0.1.1
File Interpreter ABI Platform
mpaia-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / mpaia-0.1.1.tar.gz

Download URL mpaia-0.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
01d03314e1252ef55b41ef405de7d930b2407b3c3cc6478242be62dec882efe9
BLAKE2b-256 checksum
How to use checksums
74ed122888d98a8bc6cbab8c81bde9c69f44eac7f4b9c9cfcfd554d992871fcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / mpaia-0.1.1-py3-none-any.whl

Download URL mpaia-0.1.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee076ffeb8ae71b07f8e621018600ba01dbd9b172d52751d7a3451dcd2b361cc
BLAKE2b-256 checksum
How to use checksums
cd05bd0e54a32ae4b465dc8802ee5f1eb6523082b58acc96259cbe62865a83a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6

Security for mpaia 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page