Overview
The LLMs.txt generator creates a text file that provides structured information about the API documentation to Large Language Models (LLMs) at inference time. This follows the llms.txt specification.The llms.txt format helps LLMs understand the structure and content of your documentation, improving their ability to answer questions accurately.
Metadata
Generator identifier
Generator version
Requires metadata generator output as input
Configuration
Path to the llms.txt template file
Output directory path for the generated llms.txt file
Base URL for generating absolute links to API documentation pages
Output Format
The generator produces:- Single file:
llms.txt - Format: Plain text with template header + API links list
- Content: Links to all top-level API documentation pages
Usage
Dependency Chain
- ast - Parses Markdown to AST
- metadata - Extracts API metadata
- llms-txt - Creates LLM-friendly documentation index
Implementation Details
The generator:- Reads the template from
templatePath - Filters entries to depth-1 headings (top-level modules)
- Builds API documentation links using
buildApiDocLink - Formats as a bulleted list
- Appends to template content
- Writes to
llms.txt
Link Format
Each API link is formatted as:Template Structure
The template should include:- Project description
- Documentation overview
- Usage instructions for the API
- A section where API links will be appended
src/generators/llms-txt/