Skip to content

agustif/llm-plugin-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-plugin-pdf

PyPI Changelog Tests License

LLM plugin for loading text from PDF files (local or URL) using PyMuPDF.

Installation

Install this plugin in the same environment as LLM.

llm install llm-plugin-pdf

This plugin requires the PyMuPDF and requests packages.

Usage

This plugin adds support for the pdf: fragment prefix. You can use it to load the full text content of a PDF from a local file path or a web URL.

# Load from a local file
llm fragment pdf:/path/to/your/document.pdf

# Load from a URL
llm fragment pdf:https://example.com/some-document.pdf

You can pipe the output to LLM commands:

llm fragment pdf:https://arxiv.org/pdf/2310.06825.pdf | llm -s "Summarize this PDF"

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-pdf
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

# Install in editable mode with test dependencies
python -m pip install -e '.[test]'

To run the tests:

pytest

About

PDF fragment loader plugin for https://llm.datasette.io/

Topics

Resources

License

Stars

Watchers

Forks

Languages