Skip to content

samueldg/llm-fragments-pypi

Repository files navigation

llm-fragments-pypi

Load PyPI package metadata as LLM fragments.

Installation

Install this plugin in the same environment as LLM.

llm install llm-fragments-pypi

Usage

Use -f pypi:package_name to include the package's README and metadata as fragments.

# Retrieve a package's latest version
llm -f pypi:polars "How does the performance of polars compare to pandas?"

You can optionally specify a version with the @version suffix:

# Retrieve a specific version
llm -f pypi:pydantic@1.6 "What are the Python versions supported by pydantic?"

You can combine multiple fragments:

llm -f pypi:litestar -f pypi:fastapi \
  "What are some similarities and differences between litestar and fastapi?"

And combine with other llm features:

$ llm --schema-multi "package,version" \
  -f pypi:polars \
  -f pypi:pandas \
  "What's the latest version of each package?" \
| jq .items

[
  {
    "package": "polars",
    "version": "1.27.1"
  },
  {
    "package": "pandas",
    "version": "2.2.3"
  }
]

Development

Local Setup

To set up this plugin locally, use uv:

uv run llm install -e .

It'll take care of creating a virtual environment, installing the dependencies, and you can run a uv run llm instance that will use the local version of the plugin.

Dev dependencies

Install the dev dependencies in your local environment:

uv sync --group dev

Linting & formatting

You can format and lint the code with ruff:

uv run ruff format .
uv run ruff check .

And run the pre-commit hooks:

uv run pre-commit install

Tests

Run tests:

uv run pytest

About

LLM fragments plugin for PyPI packages metadata

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages