Skip to content

Conversation

hntrl
Copy link
Member

@hntrl hntrl commented Sep 24, 2025

Adds a new reference/ path that centralizes the logic for creating reference documentation

For Python

We can leverage the existing reference docs pipeline thats used within the langchain repo, and adapting it to include docs from more sources (see langchain-ai/langchain#33066). More details about how this works are in reference/python/README.md.

For TypeScript

We'll be keeping the existing typedoc library to render references, but we're onshoring the work of consolidating those into one reference site within this repo.

The basic process of how that happens is:

  • by reading a statically defined list of packages and their locations (defined in reference/javascript/build.ts`)
  • doing a shallow clone of each unique repo + branch
  • doing the appropriate install steps so that types can be inferred properly
  • extracting package entrypoints by reading the exports key in package.json
  • pointing typedoc to add those as entrypoints with the packages strategy
  • building the typedoc outputs to reference/dist/javascript/

New make targets

  • make build-references will run scripts to format python + js reference documentation concurrently (which will end up in reference/dist/)
  • make preview-references will run aforementioned build scripts and start a dev server (this won't work until a vercel project is configured)

Vercel Setup

In order for these changes to be reflected on reference.langchain.com, a new Vercel project needs to be created (which can happen once this is merged).

This was tested against a "test" vercel setup and works as expected, with both reference targets accessible from their respective subpaths

Copy link

Preview ID generated: preview-hunter-1758679182-cd1c23d

Copy link

Preview ID generated: preview-hunter-1758680590-20d9941

@github-actions github-actions bot added the python For content related to the Python version of LangChain projects label Sep 24, 2025
Copy link

Preview ID generated: preview-hunter-1758739226-ad8ea45

@eyurtsev eyurtsev self-assigned this Sep 24, 2025
"""
for member in tar.getmembers():
member_path = path / member.name
if not member_path.is_relative_to(path):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any attacks possible via symbolic links? I think the is_relative_to eliminates them effectively?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah pretty sure. Am less concerned about this since this only becomes an issue if we get MIM'd (github gets hacked) or the ref docs build starts including symlinks (one of us merges a REALLY bad change)

@@ -0,0 +1,14 @@
"""Main entry point for the Python reference docs build."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lol definitely claude generated.

I've only ever seen claude use __main__

Copy link
Member Author

Choose a reason for hiding this comment

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

if you give a hunter an infinite amount of tokens and time he will eventually rewrite all of python

..
https://en.wikipedia.org/wiki/Infinite_monkey_theorem

Copy link
Collaborator

@mdrxy mdrxy left a comment

Choose a reason for hiding this comment

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

Looks like a good start

Copy link

Preview ID generated: preview-hunter-1758748238-4caa2ef

@eyurtsev eyurtsev merged commit 910001c into main Sep 24, 2025
12 checks passed
@eyurtsev eyurtsev deleted the hunter/references branch September 24, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci javascript python For content related to the Python version of LangChain projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants