Skip to main content

Use PyMuPDF to insert PDFs as markdown

Project description

llm-fragments-pdf

A fragment loader for LLM that converts PDF files into markdown plaintext using PyMuPDF4LLM.

This is especially useful for models which don't support attachments.

PyPI Changelog Tests License

Installation

Install this plugin in the same environment as LLM:

llm install llm-fragments-pdf

Usage

Use -f 'pdf:filepath' convert a pdf file to markdown text and insert that text as a fragment.

Example:

llm -f 'pdf:my_pdf.pdf' "What is this document about?"

The output includes:

  • Filename
  • PDF contents as markdown

Development

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

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

Install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Dependencies

  • PyMuPDF4LLM: For extracting markdown from PDFs
  • llm: The LLM CLI tool this plugin extends

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_fragments_pdf-0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_fragments_pdf-0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file llm_fragments_pdf-0.1.tar.gz.

File metadata

  • Download URL: llm_fragments_pdf-0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_fragments_pdf-0.1.tar.gz
Algorithm Hash digest
SHA256 59d71ec2d111b10401de54fa65dd19b6e1bd01951ff084b56bf599b538815766
MD5 34161427c64f40b8179a3c523be21e9f
BLAKE2b-256 591942a425f22fd0ed8797a229ff05499e725bee8dae6fdfa5ab451697541e99

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_fragments_pdf-0.1.tar.gz:

Publisher: publish.yml on daturkel/llm-fragments-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_fragments_pdf-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_fragments_pdf-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d821e2d82ebcff5310bda71447494330982ffee773dbcca7b7ecee8275655f7f
MD5 6236508eac50657db9cfd0ed6b0e810a
BLAKE2b-256 09507353f001911b73caf4eaec112bf2ce4421af50f3b0e03040506a60608aa2

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_fragments_pdf-0.1-py3-none-any.whl:

Publisher: publish.yml on daturkel/llm-fragments-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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