diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..477e6923 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +install-vercel-deps: + yum -y update + yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip rsync -y + +PYTHON = .venv/bin/python + +build-api-ref: + git clone -b bagatur/update_py_api_ref --depth=1 https://github.com/langchain-ai/langsmith-sdk.git + python3 -m venv .venv + . .venv/bin/activate + $(PYTHON) -m pip install --upgrade pip + $(PYTHON) -m pip install --upgrade uv + cd langsmith-sdk && ../$(PYTHON) -m uv pip install -r python/docs/requirements.txt + $(PYTHON) langsmith-sdk/python/docs/create_api_rst.py + LC_ALL=C $(PYTHON) -m sphinx -T -E -b html -d langsmith-sdk/python/docs/_build/doctrees -c langsmith-sdk/python/docs langsmith-sdk/python/docs langsmith-sdk/python/docs/_build/html -j auto + $(PYTHON) langsmith-sdk/python/docs/scripts/custom_formatter.py langsmith-sdk/docs/_build/html/ + + +vercel-build: install-vercel-deps build-api-ref + mkdir -p static/reference/python + mv langsmith-sdk/python/docs/_build/html/* static/reference/python/ + rm -rf langsmith-sdk + NODE_OPTIONS="--max-old-space-size=5000" yarn run docusaurus build + diff --git a/docs/reference/index.md b/docs/reference/index.md index 9c1ffb59..dee88f9a 100644 --- a/docs/reference/index.md +++ b/docs/reference/index.md @@ -14,7 +14,7 @@ Technical reference that covers components, APIs, and other aspects of LangSmith ### SDK -- [Python SDK Reference](https://langsmith-sdk.readthedocs.io/en/latest/) +- [Python SDK Reference](https://langsmith-docs-git-bagatur-rfcbuiltinsdkref-langchain.vercel.app/reference/python) - [LangChain off-the-shelf evaluators (Python only)](./reference/sdk_reference/langchain_evaluators) ### Common data types diff --git a/docusaurus.config.js b/docusaurus.config.js index 33c16111..615e9960 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -134,9 +134,19 @@ const config = { position: "right", }, { - href: "https://api.smith.langchain.com/redoc", - label: "Go to API Docs", + type: "dropdown", + label: "API Reference", position: "left", + items: [ + { + label: "REST", + href: "https://api.smith.langchain.com/redoc", + }, + { + label: "Python", + to: "https://langsmith-docs-git-bagatur-rfcbuiltinsdkref-langchain.vercel.app/reference/python", + }, + ], }, ], }, diff --git a/package.json b/package.json index 54d64b71..2eb6fdf6 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "docusaurus": "docusaurus", "test": "jest", "start": "rm -rf ./docs/api && docusaurus start", - "build": "rm -rf ./build && docusaurus build", - "vercel-build": "git submodule update --init --recursive && python3 -m ensurepip --default-pip && python3 -m pip install -r subdirectories/scripts/requirements.txt && python3 subdirectories/scripts/build_cookbook.py && ls docs && npm run build", + "build": "make vercel-build", + "vercel-build": "ls .; cat Makefile; make vercel-build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", diff --git a/vercel.json b/vercel.json index 75bd5c29..7cbcf89c 100644 --- a/vercel.json +++ b/vercel.json @@ -201,6 +201,10 @@ { "source": "/evaluation/how_to_guides/human_feedback/:path*", "destination": "/evaluation/how_to_guides/:path*" + }, + { + "source": "/reference/python(/?)", + "destination": "/reference/python/reference" } ], "builds": [