mirror of
https://github.com/langchain-ai/docs.git
synced 2026-07-23 04:45:23 -04:00
910001ce1a
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 https://github.com/langchain-ai/langchain/pull/33066). More details about how this works are in `reference/python/README.md`. ## For TypeScript We'll be keeping the existing [typedoc](https://typedoc.org/) 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](https://typedoc.org/documents/Options.Input.html#packages) * 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
20 lines
624 B
Python
20 lines
624 B
Python
"""Errors for the Python reference docs build."""
|
|
|
|
|
|
class TarPathTraversalError(Exception):
|
|
"""Raised when a tar extraction would escape the target directory."""
|
|
|
|
def __init__(self) -> None:
|
|
"""Initialize the exception."""
|
|
super().__init__("Attempted path traversal in tar file")
|
|
|
|
|
|
class InvalidTarballURLSchemeError(ValueError):
|
|
"""Raised when the tarball URL uses an unsupported scheme."""
|
|
|
|
def __init__(self, scheme: str) -> None:
|
|
"""Initialize the exception."""
|
|
super().__init__(
|
|
f"Only https URLs are allowed for tarball downloads (got {scheme!r})"
|
|
)
|