Skip to main content

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

  1. Clone the repository:

    git clone https://github.com/sTomerG/mpaia.git
    cd mpaia
    
  2. Install the package:

    pip install -e .
    

Configuration

  1. Create a .env file in the root directory 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.

  2. Create a user_config directory in the root of the project if it doesn't exist already.

Usage

  1. Create custom jobs by subclassing TelegramMessageJob in user_config/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 in the user_config directory to set up and run your bot:

    from dotenv import load_dotenv
    
    from mpaia.telegram_bot import TelegramBot
    from mpaia.assistant import OpenAIAssistant
    from custom_jobs import SalaryJob
    
    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))
    
        bot.run()
    
    if __name__ == "__main__":
        run_bot()
    
  3. Run your bot:

    python user_config/run_bot.py
    

Customization

  • To add more custom jobs, create new classes in user_config/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.

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

mpaia-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

mpaia-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file mpaia-0.1.0.tar.gz.

File metadata

  • Download URL: mpaia-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mpaia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8712afc04f680f5f57bd344970c08d577fb3cb0a2472d01fb206b68bed9eaf26
MD5 143ff9230044a29db901dfe3c2456c7a
BLAKE2b-256 9e33fc215d3f8edd2cabe2540e6b8f228efd26e5abd0dfb64e2be6f64b097d1c

See more details on using hashes here.

File details

Details for the file mpaia-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mpaia-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mpaia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0a3a058295e828c602685bc541312a7253363d5f49a4516b45043be39281fff
MD5 7916bc7985f858730255afd31a7019de
BLAKE2b-256 734a412bc0a115dffe3fba5d636ad3f0fdc646e0a340747d1ade9059780bf93f

See more details on using hashes here.

Supported by

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