A Python CLI tool that intelligently renames PDF files using LLaMA AI model integration. It extracts text from PDFs and generates meaningful filenames based on the content.
- Extracts text content from PDF files
- Uses LLaMA AI to generate meaningful filenames
- Supports different LLaMA models
- Includes test mode for safe operation
- Handles batch processing of multiple PDFs
- Configurable context window sizes
- Built-in error handling and validation
- Python 3.11 or higher
- Ollama running locally with LLaMA models installed
- Git (for cloning the repository)
- Clone the repository:
git clone https://github.com/max-rousseaupdf-namer.git
cd pdf-namer- Install dependencies:
pip install -r requirements.txtBasic usage:
python pdf_renamer.py /path/to/pdf/directoryOptions:
--test-mode: Run without actually renaming files (recommended for first use)--model: Specify which LLaMA model to use (default: llama3.1:70b-instruct-q8_0)--all-files: Process all PDF files regardless of filename pattern
Example with options:
python pdf_renamer.py --test-mode --model "llama3.1:70b-instruct-q8_0" /path/to/pdfsBy default, the script processes files matching the pattern:
YYYY_MM_DD_HH_MM_SS_*.pdf
Output format:
YYYY.MM.DD - Descriptive Name.pdf
pytestFor coverage report:
pytest --cov=. --cov-report=term-missing- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the BSD 2-Clause License - see the LICENSE file for details.
- More than 90% of this project was developed using Aider, an AI pair programming tool
- Uses the Ollama API for LLaMA model integration
- Built with PyPDF for PDF text extraction