llms-txt-action


Namellms-txt-action JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryGitHub Action to make documentation more accessible to LLMs.
upload_time2025-01-07 22:10:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords documentation github-action llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llms-txt-actions

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/demodrive-ai/llms-txt-action)](https://github.com/demodrive-ai/llms-txt-action/releases)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/demodrive-ai/llms-txt-action/ci.yml?branch=main)](https://github.com/demodrive-ai/llms-txt-action/actions)
[![License](https://img.shields.io/github/license/demodrive-ai/llms-txt-action)](LICENSE)


### 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](https://www.answer.ai/), for more details read: https://llmstxt.org/.

![File Structure](docs/file_structure.png)

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](https://readthedocs.io/), [MKDocs](https://www.mkdocs.org/), [Sphinx](https://www.sphinx-doc.org/en/master/index.html#) and more.
- 🌈 **All Formats** : Can process HTML, PDF, Images, DOCX, PPTX, XLSX (thanks to [docling](https://github.com/DS4SD/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](https://github.com/BerriAI/litellm), you can use upto 150 models like OpenAI, VertexAI, Cohere, Anthropic.


## Quick Start

There are two ways to access this library.

1. Add this to your GitHub workflow:

```yaml

    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.

```bash
# 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

1. Clone and install:

   ```bash
   # clone the repo
   uv sync
   ```

1. Run the crawler:

   ```bash
   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:

1. `.readthedocs.yaml` - The main ReadtheDocs configuration file that defines the build environment and process
2. `docs/requirements.txt` - Python package dependencies needed for building your documentation

Here's how to set up both files:

```yaml
# .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

```

```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:

1. First, ensure you have a working MkDocs setup with your documentation source files.

2. Create or update your GitHub Actions workflow file (e.g., `.github/workflows/docs.yml`) with the following configuration:


```yaml
# 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:

1. First, ensure you have a working Sphinx documentation setup with a `docs/` directory containing your source files and configuration.

2. Create or update your GitHub Actions workflow file (e.g., `.github/workflows/docs.yml`) with the following configuration:

```yaml
#...
#...
      - 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](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llms-txt-action",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "documentation, github-action, llm",
    "author": null,
    "author_email": "DemoDrive AI <founders@demodrive.tech>",
    "download_url": "https://files.pythonhosted.org/packages/62/ec/d6e34cd9f98e6d0395026e1efeaede166cb670ccabad1b6cc49ba24ebbb0/llms_txt_action-1.0.2.tar.gz",
    "platform": null,
    "description": "# llms-txt-actions\n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/demodrive-ai/llms-txt-action)](https://github.com/demodrive-ai/llms-txt-action/releases)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/demodrive-ai/llms-txt-action/ci.yml?branch=main)](https://github.com/demodrive-ai/llms-txt-action/actions)\n[![License](https://img.shields.io/github/license/demodrive-ai/llms-txt-action)](LICENSE)\n\n\n### Make your documentation LLM friendly.\n\nThis Github action/CLI tool can automatically generate markdown (.md) files for each endpoint in your documentation as per the standard proposed by [answer.ai](https://www.answer.ai/), for more details read: https://llmstxt.org/.\n\n![File Structure](docs/file_structure.png)\n\nIt completely runs locally be default, by passing MODEL_API_KEY one can choose to engage hosted cloud AI services to generate page summaries.\n\n## Features\n\n- \ud83d\udcc4 **Content Processing**: Generate LLM-ready markdown (.md) files from popular document frameworks such as [Readthedocs](https://readthedocs.io/), [MKDocs](https://www.mkdocs.org/), [Sphinx](https://www.sphinx-doc.org/en/master/index.html#) and more.\n- \ud83c\udf08 **All Formats** : Can process HTML, PDF, Images, DOCX, PPTX, XLSX (thanks to [docling](https://github.com/DS4SD/docling)) and convert them to Markdown. (coming soon)\n- 0\ufe0f\u20e3 **Zero Config**: Works out of the box for most file based documentation framework.\n- \ud83d\udcbe **Generate Summaries**: Using LLMs, we generate concise summary of each page.\n- \ud83d\udcd5 **BYO-Model**: Thanks to [litellm](https://github.com/BerriAI/litellm), you can use upto 150 models like OpenAI, VertexAI, Cohere, Anthropic.\n\n\n## Quick Start\n\nThere are two ways to access this library.\n\n1. Add this to your GitHub workflow:\n\n```yaml\n\n    steps:\n      - name: Make docs LLM ready\n        uses: demodrive-ai/llms-txt-action@v1\n\n  # OR You can choose to use an AI model to generate summaries, its completely optional.\n      steps:\n      - name: Make docs LLM ready\n        env:\n          MODEL_API_KEY: ${{ secrets.MODEL_API_KEY }}\n        uses: demodrive-ai/llms-txt-action@v1\n        # any other inputs you would like to set.\n```\nOR\n\nYou can use it outside of Github Action.\n\n```bash\n# python 3.9 or above\npip install llms-txt-action\n\nllms-txt --docs-dir site/\n# The first run takes a while as it downloads models files from the intrnet.\n```\n\n## Input Parameters\n| Parameter           | Required | Default    | Description                                  |\n|---------------------|----------|------------|----------------------------------------------|\n| `docs_dir`          | No       | `site/`    | Documentation output directory               |\n| `skip_llms_txt`     | No       | `true`     | Skip llms.txt file generation.                   |\n| `skip_llms_full_txt` | No  | `true`     | skip llms-full.txt file generation.              |\n| `skip_md_files`     | No       | `true`     | Skip generation of markdown files                |\n| `llms_txt_name`     | No       | `llms.txt` | Name of the llms.txt output file             |\n| `llms_full_txt_name`| No       | `llms-full.txt` | Name of the llms-full.txt output file   |\n| `sitemap_path`      | No       | `sitemap.xml` | Path relative to docs_dir to the sitemap.xml file [default: sitemap.xml] |\n| `model_name`        | No       | `gpt-4o`    | Whether to push generated files to github artifacts |\n\n\n\n\n## Secret Parameters\n| Parameter           | Required | Default    | Description                                 |\n|---------------------|----------|------------|----------------------------------------------|\n| `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.                |\n\n\n\n\n## Local Development\n\n1. Clone and install:\n\n   ```bash\n   # clone the repo\n   uv sync\n   ```\n\n1. Run the crawler:\n\n   ```bash\n   uv run python -m \"llms_txt_action.entrypoint\" --docs-dir site/\n   ```\n\n## Examples\n\n### ReadtheDocs\n\nTo integrate llms-txt-action with ReadtheDocs, you'll need to configure two files in your project:\n\n1. `.readthedocs.yaml` - The main ReadtheDocs configuration file that defines the build environment and process\n2. `docs/requirements.txt` - Python package dependencies needed for building your documentation\n\nHere's how to set up both files:\n\n```yaml\n# .readthedocs.yaml\nversion: 2\n\nbuild:\n  os: ubuntu-22.04\n  tools:\n    python: \"3.12\" # ^3.9 is supported.\n  jobs:\n    post_build:\n      - llms-txt --docs-dir $READTHEDOCS_OUTPUT/html\n\nmkdocs:\n  configuration: mkdocs.yml\n\npython:\n  install:\n  - requirements: docs/requirements.txt\n\n```\n\n```txt\n# docs/requirements.txt\nllms-txt-action\n```\n\n### MkDocs + Github Pages\n\nMkDocs 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:\n\n1. First, ensure you have a working MkDocs setup with your documentation source files.\n\n2. Create or update your GitHub Actions workflow file (e.g., `.github/workflows/docs.yml`) with the following configuration:\n\n\n```yaml\n# github action - .github/workflows/docs.yml\n\n      - name: Generate static files\n        run : mkdocs build\n\n      - name: Make docs LLM ready\n        uses: demodrive-ai/llms-txt-action@v1\n\n      - name: Deploy to Github\n        run : mkdocs gh-deploy --dirty\n        # --dirty helps keep the generated .md and .txt files from getting deleted.\n```\n\n### Sphinx + Github Pages\nSphinx is a popular documentation generator for Python projects. Here's how to integrate llms-txt-action with Sphinx and GitHub Pages:\n\n1. First, ensure you have a working Sphinx documentation setup with a `docs/` directory containing your source files and configuration.\n\n2. Create or update your GitHub Actions workflow file (e.g., `.github/workflows/docs.yml`) with the following configuration:\n\n```yaml\n#...\n#...\n      - name: Build HTML\n        uses: ammaraskar/sphinx-action@master\n      - name: Make docs LLM Ready\n        uses: demodrive-ai/llms-txt-action@v1\n        with:\n          name: docs-dir\n          path: docs/build/html/\n      - name: Deploy\n        uses: peaceiris/actions-gh-pages@v3\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          publish_dir: docs/build/html\n#...\n#...\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "GitHub Action to make documentation more accessible to LLMs.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/demodrive-ai/llms-txt-action",
        "Repository": "https://github.com/demodrive-ai/llms-txt-action"
    },
    "split_keywords": [
        "documentation",
        " github-action",
        " llm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2816991dab3bfefa8ec092edc47b631c1c0613ddf3ec4603ef252d0dadc53215",
                "md5": "c03b7f6812ab841e8ad3fbf56aab0247",
                "sha256": "0e78f783e5b936d345f68ea21b69686b61b8a761ef1e90031f33671aa2118c34"
            },
            "downloads": -1,
            "filename": "llms_txt_action-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c03b7f6812ab841e8ad3fbf56aab0247",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9927,
            "upload_time": "2025-01-07T22:10:23",
            "upload_time_iso_8601": "2025-01-07T22:10:23.732642Z",
            "url": "https://files.pythonhosted.org/packages/28/16/991dab3bfefa8ec092edc47b631c1c0613ddf3ec4603ef252d0dadc53215/llms_txt_action-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62ecd6e34cd9f98e6d0395026e1efeaede166cb670ccabad1b6cc49ba24ebbb0",
                "md5": "a130ba537aacd19c6b459234b58b11e3",
                "sha256": "b74213ae12f4694147188e45b32513652246fcc1551cb47f13945cd3d4ec1880"
            },
            "downloads": -1,
            "filename": "llms_txt_action-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a130ba537aacd19c6b459234b58b11e3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 296612,
            "upload_time": "2025-01-07T22:10:26",
            "upload_time_iso_8601": "2025-01-07T22:10:26.663895Z",
            "url": "https://files.pythonhosted.org/packages/62/ec/d6e34cd9f98e6d0395026e1efeaede166cb670ccabad1b6cc49ba24ebbb0/llms_txt_action-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 22:10:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "demodrive-ai",
    "github_project": "llms-txt-action",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llms-txt-action"
}
        
Elapsed time: 0.44142s