Skip to content

Make use of mkdocs-llmstxt #1427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025
Merged

Make use of mkdocs-llmstxt #1427

merged 2 commits into from
Apr 15, 2025

Conversation

Viicos
Copy link
Member

@Viicos Viicos commented Apr 9, 2025

Fixes #1028.

Copy link
Contributor

hyperlint-ai bot commented Apr 9, 2025

PR Change Summary

Introduced support for the llms.txt format in the PydanticAI documentation.

  • Added a section on llms.txt format and its purpose
  • Provided links to llms.txt and llms-full.txt files
  • Mentioned the limitations of current LLM frameworks with llms.txt

Modified Files

  • docs/index.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@Viicos Viicos force-pushed the mkdocsllmstxt branch 2 times, most recently from 7384387 to 1df21f8 Compare April 9, 2025 16:26
Copy link

github-actions bot commented Apr 9, 2025

Docs Preview

commit: dc46b4c
Preview URL: https://fc08d9c1-pydantic-ai-previews.pydantic.workers.dev

mkdocs.yml Outdated
Comment on lines 217 to 244
sections:
Concepts documentation:
- agents.md
- models.md
- dependencies.md
- tools.md
- common-tools.md
- results.md
- message-history.md
- multi-agent-applications.md
Graphs:
- graph.md
Evals:
- evals.md
MCP:
- mcp/*.md
Optional:
- testing.md
- cli.md
- logfire.md
- examples/*.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we opt-out for pages instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as of today, but you can open a feature request at https://github.com/pawamoy/mkdocs-llmstxt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is the llms.txt format is defined as being "flat" (see https://llmstxt.org/#format), so it can't really follow the documentation structure that may be nested under multiple levels.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to remember to update this when I add a new page to the docs. I need something that can keep the docs up-to-date.

Copy link

@aristideubertas aristideubertas Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this section be generated dynamically as part of the deployment pipeline in github actions, possibly reusing the existing nav, specifying opt-outs if needed? The default behaviour would then be to include all documentation.

Copy link
Member Author

@Viicos Viicos Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would require dynamically generating the MkDocs config file in some way, and as I mentioned above we can't blindly follow the documentation layout as the llms.txt format can't be nested.

Imo the llms.txt format should be the one evolving instead. This flat layout limitation doesn't really make sense and most probably can be removed. It would then be easier for us to follow the documentation structure and exclude some pages if wanted.

Comment on lines +198 to +215
## llms.txt

The PydanticAI documentation is available in the [llms.txt](https://llmstxt.org/) format.
This format is defined in Markdown and suited for large language models.

Two formats are available:

- [llms.txt](https://ai.pydantic.dev/llms.txt): a file containing a brief description
of the project, along with links to the different sections of the documentation. The structure
of this file is described in details [here](https://llmstxt.org/#format).
- [llms-full.txt](https://ai.pydantic.dev/llms-full.txt): Similar to the `llms.txt` file,
but every link content is included. Note that this file may be too large for some LLMs.

As of today, these files *cannot* be natively leveraged by LLM frameworks or IDEs. Alternatively,
an [MCP server](https://modelcontextprotocol.io/) can be implemented to properly parse the `llms.txt`
file.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to document this? Isn't it already useful to have it discoverable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to go this way a when discussing it in a call: have it documented with a small section on Pydantic, pAI and logfire

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also leave it for a while for users to be aware of it and remove it at a later point.

@Viicos Viicos enabled auto-merge (squash) April 15, 2025 09:05
@Kludex Kludex closed this Apr 15, 2025
auto-merge was automatically disabled April 15, 2025 10:31

Pull request was closed

@Kludex Kludex reopened this Apr 15, 2025
@Kludex
Copy link
Member

Kludex commented Apr 15, 2025

closed and opened to trigger the pipeline

@Kludex Kludex merged commit 77723fe into main Apr 15, 2025
18 checks passed
@Kludex Kludex deleted the mkdocsllmstxt branch April 15, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create llms.txt and llms-full.txt
3 participants