Introduction
This project demonstrates the integration of AI-powered language models as function callers and workflow orchestrators. The system is built with three distinct functionalities:
Intelligent File Organization: Automatically categorizes files into Documents, Images, Code, and Others directories based on LLM-powered file classification.
Smart Compression: Identifies and compresses PDF documents and image files using external services while maintaining organized folder structures.
Todo Task Automation: Parses natural language tasks from a todo.txt file and executes them as:
Email reminders
Calendar invites
Stock price alerts
The system showcases advanced software engineering concepts including modular design, LLM orchestration, external API integration, and task automation.
Architecture
The system follows a layered architecture:
Gemini 2 Flash: Used for efficient inference across all LLM tasks
Configuration: API keys stored in environment variables for secure access
Prompt Engineering: Carefully crafted prompts for specific task interpretation
The LLMs serve as function callers rather than direct executors, maintaining a clean separation between interpretation and execution layers.
External API Integration
The system integrates with several external services:
ILovePDF - PDF compression service with comprehensive API
TinyPNG - Image optimization service with programmatic access
Gmail SMTP - Email delivery for task notifications and reminders
Google Calendar API - Calendar event creation and invitation management
Yahoo Finance (yfinance) - Real-time stock data retrieval
Google Gemini API - Advanced language model for intelligent orchestration
Setup and Installation
Prerequisites
Python 3.8+
Google Gemini API key
Accounts for TinyPNG and ILovePDF
Google account for Gmail and Calendar integration
Installation
Clone the repository:
git clone
cd intelligent-file-task-automation
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Create a .env file with your API keys:
PDF_COMPRESSION_API_KEY_PUBLIC=your_pdf_api_key_public
PDF_COMPRESSION_API_KEY_SECRET=your_pdf_api_key_secret
IMAGE_COMPRESSION_API_KEY=your_image_api_key
GMAIL_USER=your_gmail_address
GMAIL_PASS=your_app_password # Generate from Google Account
GEMINI_API_KEY=your_gemini_api_key
Set up Google Calendar API credentials:
Download your credentials.json from Google Cloud Console
Place in the project root directory
Usage
Running the Application
Start the agent with:
python main.py
The interactive agent will:
Prompt you to select tasks (organize files, compress files, run todo tasks)
Ask for the target folder location
Execute the tasks with LLM-powered orchestration
Todo Task Format
The system recognizes these todo.txt formats:
Email reminders:
send this email Test Email \n\nDear User,\n\nThis is a test email and a gentle reminder to complete task so and so.\n\nBest,\nSystem via email to user@example.com
Calendar invites:
Add a calendar invite for Team meeting for tomorrow i.e. 2025-02-25 at 11 AM IST and share it with user@example.com
Stock alerts:
Share the stock price of NVDA every day at 9 AM via email to user@example.com
Project Structure
capstone_project/
├── My_Folder/ # User's working directory (created during execution)
│ ├── Files/ # Default location for unorganized files
│ │ ├── todo.txt # User's todo tasks file
│ │ └── ... # Other user files to be organized
│ ├── Documents/ # Created by organizer
│ ├── Images/ # Created by organizer
│ ├── Code/ # Created by organizer
│ └── Others/ # Created by organizer
├── src/
│ ├── llm/
│ │ ├── agent.py # Lines 1-102 from agent.py context
│ │ ├── orchestrator.py # Lines 1-192 from orchestrator.py context
│ │ └── ... # Other LLM modules
│ ├── file_organizer/
│ │ ├── organizer.py # Lines 1-179 from organizer.py context
│ │ └── ... # File classification logic
│ ├── compression/
│ │ ├── pdf_compressor.py # Referenced in orchestrator.py lines 133-134
│ │ └── image_compressor.py # Referenced in orchestrator.py lines 134-135
│ ├── todo/ # Contains todo task execution logic
│ └── ... # Other modules
├── main.py # Lines 1-35 from main.py context
├── requirements.txt
├── todo.txt # Sample todo file
└── .env # Environment variables
There are no models linked
There are no models linked
There are no datasets linked
There are no datasets linked