llms-txt-actions
Make your documentation LLM friendly.
This Github action/CLI tool can automatically generate markdown (.md) files for each endpoint in your documentation as per the standard proposed by answer.ai, for more details read: https://llmstxt.org/.
It completely runs locally be default, by passing MODEL_API_KEY one can choose to engage hosted cloud AI services to generate page summaries.
Features
- 📄 Content Processing: Generate LLM-ready markdown (.md) files from popular document frameworks such as Readthedocs, MKDocs, Sphinx and more.
- 🌈 All Formats : Can process HTML, PDF, Images, DOCX, PPTX, XLSX (thanks to docling) and convert them to Markdown. (coming soon)
- 0️⃣ Zero Config: Works out of the box for most file based documentation framework.
- 💾 Generate Summaries: Using LLMs, we generate concise summary of each page.
- 📕 BYO-Model: Thanks to litellm, you can use upto 150 models like OpenAI, VertexAI, Cohere, Anthropic.
Quick Start
There are two ways to access this library.
- Add this to your GitHub workflow:
steps:
- name: Make docs LLM ready
uses: demodrive-ai/llms-txt-action@v1
# OR You can choose to use an AI model to generate summaries, its completely optional.
steps:
- name: Make docs LLM ready
env:
MODEL_API_KEY: ${{ secrets.MODEL_API_KEY }}
uses: demodrive-ai/llms-txt-action@v1
# any other inputs you would like to set.
OR
You can use it outside of Github Action.
# python 3.9 or above
pip install llms-txt-action
llms-txt --docs-dir site/
# The first run takes a while as it downloads models files from the intrnet.
Input Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
docs_dir |
No | site/ |
Documentation output directory |
skip_llms_txt |
No | true |
Skip llms.txt file generation. |
skip_llms_full_txt |
No | true |
skip llms-full.txt file generation. |
skip_md_files |
No | true |
Skip generation of markdown files |
llms_txt_name |
No | llms.txt |
Name of the llms.txt output file |
llms_full_txt_name |
No | llms-full.txt |
Name of the llms-full.txt output file |
sitemap_path |
No | sitemap.xml |
Path relative to docs_dir to the sitemap.xml file [default: sitemap.xml] |
model_name |
No | gpt-4o |
Whether to push generated files to github artifacts |
Secret Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
MODEL_API_KEY |
No | None | This key (eg. OPENAI_API_KEY) will be used to summarize pages to create llms.txt. Needs to match the model_name provider. If using the default model_name, pass OPENAI_API_KEY. |
Local Development
-
Clone and install:
# clone the repo uv sync
-
Run the crawler:
uv run python -m "llms_txt_action.entrypoint" --docs-dir site/
Examples
ReadtheDocs
To integrate llms-txt-action with ReadtheDocs, you'll need to configure two files in your project:
.readthedocs.yaml- The main ReadtheDocs configuration file that defines the build environment and processdocs/requirements.txt- Python package dependencies needed for building your documentation
Here's how to set up both files:
# .readthedocs.yaml
version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12" # ^3.9 is supported.
jobs:
post_build:
- llms-txt --docs-dir $READTHEDOCS_OUTPUT/html
mkdocs:
configuration: mkdocs.yml
python:
install:
- requirements: docs/requirements.txt
# docs/requirements.txt
llms-txt-action
MkDocs + Github Pages
MkDocs is a fast and simple static site generator that's geared towards building project documentation. Here's how to integrate llms-txt-action with MkDocs when deploying to GitHub Pages:
-
First, ensure you have a working MkDocs setup with your documentation source files.
-
Create or update your GitHub Actions workflow file (e.g.,
.github/workflows/docs.yml) with the following configuration:
# github action - .github/workflows/docs.yml
- name: Generate static files
run : mkdocs build
- name: Make docs LLM ready
uses: demodrive-ai/llms-txt-action@v1
- name: Deploy to Github
run : mkdocs gh-deploy --dirty
# --dirty helps keep the generated .md and .txt files from getting deleted.
Sphinx + Github Pages
Sphinx is a popular documentation generator for Python projects. Here's how to integrate llms-txt-action with Sphinx and GitHub Pages:
-
First, ensure you have a working Sphinx documentation setup with a
docs/directory containing your source files and configuration. -
Create or update your GitHub Actions workflow file (e.g.,
.github/workflows/docs.yml) with the following configuration:
#...
#...
- name: Build HTML
uses: ammaraskar/sphinx-action@master
- name: Make docs LLM Ready
uses: demodrive-ai/llms-txt-action@v1
with:
name: docs-dir
path: docs/build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
#...
#...
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for llms-txt-action 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llms_txt_action-1.0.2.tar.gz | 296.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llms_txt_action-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 306.5 kB
Release files / llms_txt_action-1.0.2.tar.gz
| Download URL | llms_txt_action-1.0.2.tar.gz |
|---|---|
| Size | 296.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b74213ae12f4694147188e45b32513652246fcc1551cb47f13945cd3d4ec1880
|
|
BLAKE2b-256 checksum How to use checksums |
62ecd6e34cd9f98e6d0395026e1efeaede166cb670ccabad1b6cc49ba24ebbb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 7, 2025.
Transparency logRelease files / llms_txt_action-1.0.2-py3-none-any.whl
| Download URL | llms_txt_action-1.0.2-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e78f783e5b936d345f68ea21b69686b61b8a761ef1e90031f33671aa2118c34
|
|
BLAKE2b-256 checksum How to use checksums |
2816991dab3bfefa8ec092edc47b631c1c0613ddf3ec4603ef252d0dadc53215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 7, 2025.
Transparency logSecurity for llms-txt-action 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for llms_txt_action-1.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 7, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.